From: Kevin Buettner <kevinb@redhat.com>
To: Lancelot SIX <lancelot.six@amd.com>
Cc: gdb-patches@sourceware.org, <lsix@lancelotsix.com>
Subject: Re: [PATCH] Fix stepping in rtld without debug symbol
Date: Wed, 9 Nov 2022 09:22:34 -0700 [thread overview]
Message-ID: <20221109092234.6a39e230@f35-zws-nvidia> (raw)
In-Reply-To: <20221104182634.3726422-1-lancelot.six@amd.com>
On Fri, 4 Nov 2022 18:26:34 +0000
Lancelot SIX <lancelot.six@amd.com> wrote:
> Commit be6276e0aed "Allow debugging of runtime loader / dynamic linker"
> introduced a small regression when stepping into the runtime loader /
> dynamic linker from function we do not have debug information for. This
> is reported in PR/29747.
>
> This can be shown by the following example (given by Simon Marchi in
> buzilla bug report):
>
> $ cat test.c
> #include <stdio.h>
>
> int main()
> {
> printf("Hi\n");
> return 0;
> }
> $ gcc test.c -O0 -o test
> $ ./gdb -q -nx --data-directory=data-directory test -ex start -ex s
> Reading symbols from test...
> (No debugging symbols found in test)
> Temporary breakpoint 1 at 0x1151
> Starting program: .../binutils-gdb/gdb/test
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>
> Temporary breakpoint 1, 0x0000555555555151 in main ()
> Single stepping until exit from function main,
> which has no line number information.
> /home/smarchi/src/binutils-gdb/gdb/infrun.c:6960:64: runtime error: member call on null pointer of type 'struct symbol'
>
> The crash happens here:
>
> #0 __sanitizer::Die () at ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:50
> #1 0x00007ffff5dd7128 in __ubsan::__ubsan_handle_type_mismatch_v1_abort (Data=<optimized out>, Pointer=<optimized out>) at ../../../../src/libsanitizer/ubsan/ubsan_handlers.cpp:148
> #2 0x000055556183e1a7 in process_event_stop_test (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6960
> #3 0x0000555561838ea4 in handle_signal_stop (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:6615
> #4 0x000055556182f77b in handle_inferior_event (ecs=0x7fffffffccd0) at .../binutils-gdb/gdb/infrun.c:5866
>
> When evaluating:
>
> 6956 if (execution_direction != EXEC_REVERSE
> 6957 && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
> 6958 && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
> 6959 && !in_solib_dynsym_resolve_code (
> 6961 ecs->event_thread->control.step_start_function->value_block ()
> 6962 ->entry_pc ()))
>
> we dereference, ecs->event_thread->control.step_start_function which is
> nullptr.
>
> This patch changes this condition so it evaluates to true if
> ecs->event_thread->control.step_start_function is nullptr since this
> matches the behaviour before be6276e0aed.
Thanks for fixing this!
I see that Bruno has asked for the test case to be tweaked and your
reply that you've fixed it in your local sources. That being the
case...
Approved-By: Kevin Buettner <kevinb@redhat.com>
Kevin
next prev parent reply other threads:[~2022-11-09 16:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 18:26 Lancelot SIX
2022-11-07 9:43 ` Bruno Larsen
2022-11-07 10:21 ` Lancelot SIX
2022-11-09 16:22 ` Kevin Buettner [this message]
2022-11-09 18:43 ` Lancelot SIX
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=20221109092234.6a39e230@f35-zws-nvidia \
--to=kevinb@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lancelot.six@amd.com \
--cc=lsix@lancelotsix.com \
/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).