public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Guinevere Larsen <blarsen@redhat.com>, gdb-patches@sourceware.org
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Carl Love <cel@linux.ibm.com>
Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.dwarf2/dw2-entry-points.exp on ppc64le
Date: Thu, 11 Jan 2024 14:08:29 +0100	[thread overview]
Message-ID: <078a03f2-791b-4860-ace0-e4cff4677654@suse.de> (raw)
In-Reply-To: <fe26541b-2adc-4719-8181-180bb3ddab62@redhat.com>

On 1/11/24 13:55, Guinevere Larsen wrote:
> On 11/01/2024 13:42, Tom de Vries wrote:
>> On ppc64le-linux, I run into:
>> ...
>> (gdb) bt^M
>>   #0  0x00000000100006dc in foobar (J=2)^M
>>   #1  0x000000001000070c in prog ()^M
>> (gdb) FAIL: gdb.dwarf2/dw2-entry-points.exp: bt foo
>> ...
>>
>> The test-case attemps to emulate additional entry points of a 
>> function, with
>> function bar having entry points foo and foobar:
>> ...
>> (gdb) p bar
>> $1 = {void (int, int)} 0x1000064c <bar>
>> (gdb) p foo
>> $2 = {void (int, int)} 0x10000698 <foo>
>> (gdb) p foobar
>> $3 = {void (int)} 0x100006d0 <foobar>
>> ...
>>
>> However, when setting a breakpoint on the entry point foo:
>> ...
>> (gdb) b foo
>> Breakpoint 1 at 0x100006dc
>> ...
>> it ends up in foobar instead of in foo, due to prologue skipping, and
>> consequently the backtrace show foobar instead foo.
>>
>> The problem is that the test-case does not emulate an actual prologue 
>> at each
>> entry point.
>>
>> Fix this by disabling the prologue skipping when setting a breakpoint, 
>> using
>> "break *foo".
> 
> Sorry if my question doesn't make sense, but wouldn't we also want to 
> verify that prologue skipping works correctly in a function with 
> multiple entrypoints?
> 

Agreed, ideally we'd also verify it in this test-case.

However, the commit introducing support for this also adds a test-case 
gdb.fortran/entry-point.exp which does verify that part of the 
functionality with compiler-generated entry points and prologues.

> I agree that this looks like a testsuite fail rather than a real GDB 
> bug, but I feel like we'll be losing a valuable test if we don't try it 
> at any point, especially now that it is easy to explicitly mark an 
> instruction as EPILOGUE_END in the dwarf assembler.
> 

I suppose you mean prologue_end (and I hadn't thought of that, thanks 
for the suggestion), but yes, we could do this.  It would require adding 
a .debug_line section in the dwarf assembly, something that is currently 
missing.

But given that the other test-case already tests this functionality, I'm 
not sure if it's worth the effort.

Thanks,
- Tom

  reply	other threads:[~2024-01-11 13:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 12:42 Tom de Vries
2024-01-11 12:55 ` Guinevere Larsen
2024-01-11 13:08   ` Tom de Vries [this message]
2024-01-11 13:33     ` Guinevere Larsen
2024-01-11 15:01 ` Ulrich Weigand

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=078a03f2-791b-4860-ace0-e4cff4677654@suse.de \
    --to=tdevries@suse.de \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=blarsen@redhat.com \
    --cc=cel@linux.ibm.com \
    --cc=gdb-patches@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: link
Be 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).