public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ilmalakhov at yandex dot ru" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug nptl/14568] New: Sparc64: disagreement between gdb64 and libpthread.so on where to look for %g7 Date: Mon, 10 Sep 2012 14:05:00 -0000 [thread overview] Message-ID: <bug-14568-131@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=14568 Bug #: 14568 Summary: Sparc64: disagreement between gdb64 and libpthread.so on where to look for %g7 Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: nptl AssignedTo: unassigned@sourceware.org ReportedBy: ilmalakhov@yandex.ru CC: drepper.fsp@gmail.com Classification: Unclassified Hi. There seems to be a disagreement between `gdb64' for Sparc64 and `libpthread.so' on where to look for `%g7' when setting `th_unique' in libthread_db. First of all, let's consider a situation when a 64-bit program is being debugged. According to `nptl/sysdeps/sparc/tls.h' . . . # define DB_THREAD_SELF \ REGISTER (32, 32, REG_G7 * 4, 0) REGISTER (64, 64, REG_G7 * 8, 0) . . . and `sysdeps/unix/sysv/linux/sparc/sys/ucontext.h' . . . define REG_G7 (10) . . . the value of `%g7' should be fetched from offset `8 * 10 == 0x50' of the `regs' array filled in by `ps_lgetregs ()' (see the code of `__td_ta_lookup_th_unique ()' in `libthread_db'). On the other hand, `ps_lgetregs ()' (it is implemented in gdb) ends up invoking `sparc64_collect_gregset ()' which eventually fills in this array: . . . if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1) { int offset = gregset->r_g1_offset; if (sparc32) offset += 4; /* %g0 is always zero. */ for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++) { if (regnum == i || regnum == -1) regcache_raw_collect (regcache, i, regs + offset); offset += 8; } } . . . Taking into account that `gregset' turns out to be a pointer to `sparc64_linux_ptrace_gregset' and that the `r_g1_offset' field of the latter equals to zero (see `sparc64-linux-nat.c'), `%g7' is actually placed at offset `6 * 8 == 0x30' rather than 0x50. In practice this leads to "cannot get thread info" gdb failures when debugging multithreaded apps. To fix this either `REGISTER (64, 64, 6 * 8, 0)' should\ be specified in `libpthread' or `r_g1_offset' fixed appropriately in `gdb64'. As for the case of a 32-bit app being debugged with `gdb64', there is another issue in addition to the described above. I believe that the "size" element of `_thread_db_register64' should be set to 32 rather than to 64 in 32-bit `libpthread.so' and that its "regofs" element should be increased by 4 (see the corresponding code in `gdb64' above'): # if __WORDSIZE == 64 # define DB_THREAD_SELF \ . . . REGISTER (64, 64, 6 * 8, 0) # else /* __WORDSIZE == 32 */ # define DB_THREAD_SELF \ . . . REGISTER (64, 32, 6 * 8 + 4, 0) # endif /* __WORDSIZE == 32 */ -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
next reply other threads:[~2012-09-10 14:05 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-10 14:05 ilmalakhov at yandex dot ru [this message] 2012-09-11 8:43 ` [Bug nptl/14568] " ilmalakhov at yandex dot ru 2012-09-28 7:36 ` davem at davemloft dot net 2012-09-28 7:38 ` davem at davemloft dot net 2012-09-28 7:39 ` davem at davemloft dot net 2012-10-06 5:10 ` davem at davemloft dot net 2014-06-17 4:35 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-14568-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).