public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "luis.machado at linaro dot org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/27826] 10000 timeouts running the testsuite on arm-linux-gnueabihf Date: Fri, 07 May 2021 12:40:08 +0000 [thread overview] Message-ID: <bug-27826-4717-q3tmZa7oX6@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-27826-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=27826 Luis Machado <luis.machado at linaro dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING Assignee|unassigned at sourceware dot org |luis.machado at linaro dot org --- Comment #2 from Luis Machado <luis.machado at linaro dot org> --- After investigating this, the root cause of the timeouts is caused by GDB using the wrong type of breakpoint (between a 4 bytes ARM breakpoint and a 2 bytes thumb breakpoint), which causes some unexpected results. The reason why this is happening is a bit more complex though. GDB has a couple mechanisms for tracking loading/unloading of shared libraries in dynamically-linked binaries. Via _dl_debug_state and r_brk and via stap probes. Up until Ubuntu 18.04 (glibc 2.27), GDB could not use the stap probes mechanism because it ran into a bug when parsing stap expression, thus failing the check and falling back to using the old _dl_debug_state and r_brk mechanism. The _dl_debug_state/r_brk mechanism works because we have an entry for _dl_debug_state in the .dynsym section of ld.so. Even though ld.so is completely stripped of mapping symbols (another way to tell arm/thumb modes apart), which are only available via the debug symbols file, GDB can still tell _dl_debug_state is arm or thumb mode because the ELF symbol carries a flag indicating so. That's why this fallback mechanism works. On Ubuntu 20.04, running glibc 2.31, GDB no longer runs into problems with stap probes. Thus GDB decides to use this mechanism instead of the old _dl_debug_state/r_brk one. Both mechanisms function by having GDB insert breakpoints at specific location so shared library events can be tracked. But in the stap probes case there are no real symbols. What we have is metadata that contains the name of the probe and its address. This address falls within a particular function. For example, init_start and init_complete are probe points that fall within dl_main. The probe points do not seem to carry any information about whether we have arm or thumb mode. As before, the mapping symbols should tell us what the mode is, but ld.so is stripped and doesn't carry those. But GDB could look at the ELF symbol of the function the probe is sitting at, except that these symbols (not considered special in any way) have been stripped as well. So the arm/thumb information is completely gone and GDB can no longer make the correct decision. So GDB defaults to assuming arm mode for the breakpoint to use, which is obviously wrong for thumb code. There are two possible solutions: 1 - Fallback to using _dl_debug_state/r_brk for armhf in GDB. This is considered bad by GDB's maintainers, because it means using an outdated mechanism instead of better interfaces. 2 - Don't strip glibc/ld.so function symbols that have stap probes installed in them. Right now, these are the functions that contain probes and that GDB wants to breakpoint in a special way: _dl_main, _dl_map_object_from_fd, lose, dl_open_worker and _dl_close_worker -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-05-07 12:40 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-05 10:38 [Bug gdb/27826] New: " doko at debian dot org 2021-05-05 11:54 ` [Bug gdb/27826] " luis.machado at linaro dot org 2021-05-07 12:40 ` luis.machado at linaro dot org [this message] 2021-05-07 16:14 ` doko at debian dot org 2021-05-07 20:56 ` luis.machado at linaro dot org 2021-05-07 21:44 ` sergiodj at sergiodj dot net 2022-05-13 23:41 ` luis.machado at arm 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-27826-4717-q3tmZa7oX6@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /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).