public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29747] New: Crash when stepping over printf without debug symbols
Date: Thu, 03 Nov 2022 13:46:07 +0000	[thread overview]
Message-ID: <bug-29747-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29747

            Bug ID: 29747
           Summary: Crash when stepping over printf without debug symbols
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

$ 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: /home/smarchi/build/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
/home/smarchi/src/binutils-gdb/gdb/infrun.c:6960
#3  0x0000555561838ea4 in handle_signal_stop (ecs=0x7fffffffccd0) at
/home/smarchi/src/binutils-gdb/gdb/infrun.c:6615
#4  0x000055556182f77b in handle_inferior_event (ecs=0x7fffffffccd0) at
/home/smarchi/src/binutils-gdb/gdb/infrun.c:5866


In this code:

  if (execution_direction != EXEC_REVERSE
      && ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
      && in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
      && !in_solib_dynsym_resolve_code (
          ecs->event_thread->control.step_start_function->value_block ()
              ->entry_pc ()))

ecs->event_thread->control.step_start_function is nullptr and gets
dereferenced.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-11-03 13:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 13:46 simark at simark dot ca [this message]
2022-11-03 15:59 ` [Bug gdb/29747] " lsix at lancelotsix dot com
2022-11-04 20:50 ` lsix at lancelotsix dot com
2022-11-10  9:48 ` lsix at lancelotsix dot com

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-29747-4717@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: 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).