public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug breakpoints/27151] Step will skip subsequent statements for malloc functions Date: Wed, 06 Jan 2021 13:53:38 +0000 [thread overview] Message-ID: <bug-27151-4717-keEdsVlXZB@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-27151-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=27151 --- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> --- This is slightly more convoluted. I tried to reproduce the problem on openSUSE Factory. Using -fcf-protection=full, there I managed to get a .plt.sec section. But gdb handled it ok. It did not take the "stepped into dynsym resolve code" path, but handled things fine along another path. So I debugged once more the ubuntu exec on leap. I found that at some point we do: ... /* If we are in a function call trampoline (a stub between the calling routine and the real function), locate the real function. That's what tells us (a) whether we want to step into it at all, and (b) what prologue we want to run to the end of, if we do step into it. */ real_stop_pc = skip_language_trampoline (frame, stop_pc); ... and end up in objc_language::skip_trampoline, and then in gdbarch_skip_trampoline_code, and then in find_solib_trampoline_target: ... /* If PC is in a shared library trampoline code stub, return the address of the `real' function belonging to the stub. Return 0 if PC is not in a trampoline code stub or if the real function is not found in the minimal symbol table. We may fail to find the right function if a function with the same name is defined in more than one shared library, but this is considered bad programming style. We could return 0 if we find a duplicate function in case this matters someday. */ CORE_ADDR find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) { struct minimal_symbol *tsymbol = lookup_solib_trampoline_symbol_by_pc (pc); if (tsymbol != NULL) { for (objfile *objfile : current_program_space->objfiles ()) { for (minimal_symbol *msymbol : objfile->msymbols ()) { ... So, we find that the pc is a trampoline for malloc, and start iterating over the minsyms in the objfiles. With openSUSE Leap (glibc 2.26), we find this as first match: ... $ nm /lib64/ld-linux-x86-64.so.2 | grep malloc 0000000000019710 W malloc ... With openSUSE Factory (glibc 2.32), we have instead rtld_malloc so skip_language_trampoline returns 0. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-01-06 13:53 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-05 15:31 [Bug breakpoints/27151] New: " yangyibiao at outlook dot com 2021-01-06 0:57 ` [Bug breakpoints/27151] " yangyibiao at outlook dot com 2021-01-06 12:22 ` vries at gcc dot gnu.org 2021-01-06 12:22 ` vries at gcc dot gnu.org 2021-01-06 12:25 ` vries at gcc dot gnu.org 2021-01-06 12:28 ` vries at gcc dot gnu.org 2021-01-06 13:44 ` yangyibiao at outlook dot com 2021-01-06 13:53 ` vries at gcc dot gnu.org [this message] 2021-01-06 15:37 ` vries at gcc dot gnu.org 2021-01-14 9:35 ` cvs-commit at gcc dot gnu.org 2021-01-14 9:41 ` vries at gcc dot gnu.org
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-27151-4717-keEdsVlXZB@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).