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 symtab/29236] [gdb] make viewpoints at same address explicit Date: Mon, 14 Oct 2024 15:45:42 +0000 [thread overview] Message-ID: <bug-29236-4717-BIV7habj7a@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29236-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29236 Tom de Vries <vries at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement CC| |vries at gcc dot gnu.org Summary|wrong mapping between |[gdb] make viewpoints at |address and source line |same address explicit --- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> --- The problem is that while cleverly showing 2 different debug states for the same pc (1. call to inlined code, 2. inlined code) we otherwise don't make explicit that we do this, causing user confusion. Using this sort of annotation (not sure about the logic, but works for the example): ... diff --git a/gdb/stack.c b/gdb/stack.c index 4a3e7e4ff00..18291f139d7 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1353,7 +1353,13 @@ print_frame (struct ui_out *uiout, { annotate_frame_address (); if (pc_p) - print_pc (uiout, gdbarch, frame, pc); + { + int n = frame_inlined_callees (frame); + int total = n + (get_frame_type (frame) == INLINE_FRAME ? 1 : 0); + if (total != 0) + gdb_printf ("VIEWPOINT(%d/%d)@", total - n + 1, total + 1); + print_pc (uiout, gdbarch, frame, pc); + } else uiout->field_string ("addr", "<unavailable>", metadata_style.style ()); ... we get: ... $ gdb -q -batch -iex "set trace-commands on" a.out \ -ex start \ -ex step \ -ex "bt -frame-info location-and-address" \ -ex step \ -ex "bt -frame-info location-and-address" +start Temporary breakpoint 1 at 0x410080: file small.c, line 10. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Temporary breakpoint 1, main (argc=1, argv=0xffffffffe928) at small.c:10 10 pa = &a; +step 13 access (pa); +bt -frame-info location-and-address #0 VIEWPOINT(1/2)@0x000000000041008c in main (argc=<optimized out>, argv=0xffffffffe928) at small.c:13 +step VIEWPOINT(2/2)@0x000000000041008c in access (ptr=<optimized out>) at small.c:4 4 void access (volatile char *ptr) { *ptr = 'x'; } +bt -frame-info location-and-address #0 VIEWPOINT(2/2)@0x000000000041008c in access (ptr=<optimized out>) at small.c:4 #1 VIEWPOINT(1/2)@0x000000000041008c in main (argc=<optimized out>, argv=0xffffffffe928) at small.c:13 ... shows in an in-your-face fashion that tricks are being played with the address. [ We're going to need something similar for location views, the same confusion is likely to show up once we start supporting that. ] Changing into an enhancement, updating $subject. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-10-14 15:45 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn 2022-06-09 17:09 ` [Bug symtab/29236] " yangyibiao at nju dot edu.cn 2022-06-09 17:09 ` yangyibiao at nju dot edu.cn 2022-06-12 16:05 ` tromey at sourceware dot org 2024-01-11 19:34 ` ssbssa at sourceware dot org 2024-10-14 15:45 ` vries at gcc dot gnu.org [this message] 2024-10-14 17:32 ` [Bug symtab/29236] [gdb] make viewpoints at same address explicit sam at gentoo dot 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-29236-4717-BIV7habj7a@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).