From: Sahil <icegambit91@gmail.com>
To: gdb-patches@sourceware.org, Guinevere Larsen <blarsen@redhat.com>
Cc: Sahil Siddiq <sahilcdq@proton.me>
Subject: Re: [PATCH v2] gdb: fix "frame function" issue when call is last instruction
Date: Thu, 04 Jul 2024 17:27:53 +0530 [thread overview]
Message-ID: <2958551.e9J7NaK4W3@valdaarhun> (raw)
In-Reply-To: <729a2a2f-d8d2-4f6a-a34c-781c0b8410d0@redhat.com>
Hi,
Thank you for the review.
On Wednesday, July 3, 2024 7:54:43 PM GMT+5:30 Guinevere Larsen wrote:
> [...]
> I would prefer if you wrote "the last instruction in a frame is a call"
> or something similar. I ask this because when I read the commit message,
> I thought "last instruction" was referring to last instruction executed,
> and couldn't understand why I couldn't reproduce without __builtin_abort.
>
Sorry about that. I should have been clearer. I'll modify the commit message.
> > Using "get_frame_address_in_block" instead of
> > "get_frame_pc" resolves this issue.
> >
> > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30929
> > ---
> > Changes since v1:
> > * frame-selection-last-instr-call.exp: Modify test to fix regressions on
> > arm/aarch64
> >
> > Patch v1:
> > https://sourceware.org/pipermail/gdb-patches/2024-June/210251.html
> And responding to your v1 comment about why you created a new test file,
> you mention creating a new C file for this test. Have you tried
> extending the original frame-selection.c file with a new function that
> calls __builtin_abort instead?
I tried extending frame_selection.c initially but I was uncertain about
adding a function that calls __builtin_abort since "main" would never
return. I thought the last statement in main - "return i + j" - also plays
a role in the test.
After taking a look at the test again, I don't think that should cause
a hindrance. I'll experiment with this.
> It seems to me that it should work, and
> you should be able to extend the existing frame-selection.exp file, but
> I might be missing something.
>
> I would prefer if we just extended the test, instead of added a new one,
> but if I indeed missed something and it isn't as easy to extend it as I
> think, we can have the new test :)
>
I don't think extending frame-selection.exp should be difficult. I was mainly
unsure about frame-selection.c.
> [...]
> > diff --git a/gdb/testsuite/gdb.base/frame-selection-last-instr-call.exp
> > b/gdb/testsuite/gdb.base/frame-selection-last-instr-call.exp new file
> > mode 100644
> > index 0000000000..5ba52cc069
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.base/frame-selection-last-instr-call.exp
> > @@ -0,0 +1,130 @@
> > +# Copyright 2024 Free Software Foundation, Inc.
>
> If we do keep this test, the copyright year should be kept as 2018-2024,
> since the file is very close to an existing file.
Ok, understood.
> [...]
> > +runto_main
> > +gdb_breakpoint abort
> > +gdb_continue_to_breakpoint abort
> > +
> > +gdb_test "bt" "#0 $hex in abort .*#1 $hex in frame_1 .*#2 $hex in
> > main.*" "backtrace at breakpoint"
> Similarly, if we keep this test, I would prefer if this backtrace test
> used the "multi_line". That's because ".*" could eat whole lines, and
> make the test pass when it shouldn't. Something like:
>
> gdb_test "bt" [multi_line "#0 $hex in abort \[^\\r\\n\]*" "#1 $hex in
> frame_1\[^\\r\\n\]*" "#2 $hex in main \[^\\r\\n\]*"] "backtrace at
> breakpoint"
>
> (with the appropriate line breaks, also I haven't tested the regexes,
> they probably have some error in them).
>
Got it. I'll modify this.
Thanks,
Sahil
prev parent reply other threads:[~2024-07-04 11:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 19:53 Sahil Siddiq
2024-07-03 14:24 ` Guinevere Larsen
2024-07-04 11:57 ` Sahil [this message]
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=2958551.e9J7NaK4W3@valdaarhun \
--to=icegambit91@gmail.com \
--cc=blarsen@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sahilcdq@proton.me \
/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