From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 7CAC03888825; Fri, 18 Mar 2022 19:25:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CAC03888825 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix crash with stepi, no debug info, and "set debug infrun 1" X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: da729c5ccde6eeccae539cbe51a285bc84769b3d X-Git-Newrev: b7e077222ee350f4bd6c76134064acdbd2ce2b32 Message-Id: <20220318192522.7CAC03888825@sourceware.org> Date: Fri, 18 Mar 2022 19:25:22 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2022 19:25:22 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db7e077222ee3= 50f4bd6c76134064acdbd2ce2b32 commit b7e077222ee350f4bd6c76134064acdbd2ce2b32 Author: Pedro Alves Date: Fri Mar 18 19:14:25 2022 +0000 Fix crash with stepi, no debug info, and "set debug infrun 1" =20 A stepi in a function without debug info with "set debug infrun 1" crashes GDB since commit c8353d682f69 (gdb/infrun: some extra infrun debug print statements), due to a reference to "tp->current_symtab->filename" when tp->current_symtab is null. =20 This commit adds the missing null check. The output in this case becomes: =20 [infrun] set_step_info: symtab =3D , line =3D 0, step_frame_id = =3D {stack=3D0x7fffffffd980,code=3D0x0000000000456c30,!special}, step_stack= _frame_id =3D {stack=3D0x7fffffffd980,code=3D0x0000000000456c30,!special} =20 Change-Id: I5171a9d222bc7e15b9dba2feaba7d55c7acd99f8 Diff: --- gdb/infrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index bc6521c8ec6..104c29abf0a 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4180,7 +4180,8 @@ set_step_info (thread_info *tp, struct frame_info *fr= ame, =20 infrun_debug_printf ("symtab =3D %s, line =3D %d, step_frame_id =3D %s, step_stack_frame_i= d =3D %s", - tp->current_symtab->filename, tp->current_line, + tp->current_symtab !=3D nullptr ? tp->current_symtab->filename : "", + tp->current_line, tp->control.step_frame_id.to_string ().c_str (), tp->control.step_stack_frame_id.to_string ().c_str ()); }