From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7A7A53858D35; Mon, 8 May 2023 21:05:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A7A53858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683579909; bh=DiDpALuaCuOpi618Bf9h16z3BFJzgu87fUZ9QRfNEtk=; h=From:To:Subject:Date:From; b=vO5/cGLdevCkSUh3cVXIAr1PpLTVvrrL3MLdBRZ65ojyki/9FKhJQidKfEesPw7AA i32KcALzEVLe+59zf/QsIRjCcH1qy6XcEMTFP5hIZb0A+C/38aiV3sy5i0VvrDlWEE BI+glo8tcyKz+JZiJ1zql5OUZkTQspHUfdIaU9PI= From: "marian.buschsieweke at ovgu dot de" To: gdb-prs@sourceware.org Subject: [Bug gdb/30431] New: segfault when inspecting remote variable Date: Mon, 08 May 2023 21:05:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 13.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marian.buschsieweke at ovgu dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30431 Bug ID: 30431 Summary: segfault when inspecting remote variable Product: gdb Version: 13.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: marian.buschsieweke at ovgu dot de Target Milestone: --- When connecting to mspdebug to debug a microcontroller and printing the val= ue of the memory mapped register BCSCTL1 defined as: msp430-gcc-support-files/include/msp430f2617_symbols.ld 98:PROVIDE(BCSCTL1 =3D 0x0057); msp430-gcc-support-files/include/msp430f2617.h 414:sfr_b(BCSCTL1); /* Basic Clock System Con= trol 1 */ /msp430-gcc-support-files/include/iomacros.h 62:#define sfr_b(x) extern volatile unsigned char x with `p BCSCTL1` I get a segfault with the following backtrace: #0 0x0000555555723324 in language_defn::read_var_value (this=3Dthis@entry=3D0x555556d1e800 ,=20 var=3Dvar@entry=3D0x7ffff6af8030, var_block=3Dvar_block@entry=3D0x7ffff= 6a6fbd0, frame=3D...) at ../../gdb/findvar.c:756 #1 0x0000555555722326 in read_var_value (var=3Dvar@entry=3D0x7ffff6af8030, var_block=3Dvar_block@entry=3D0x7ffff6a6fbd0, frame=3D...) at ../../gdb/findvar.c:794 #2 0x00005555559ab472 in value_of_variable (var=3Dvar@entry=3D0x7ffff6af80= 30, b=3D0x7ffff6a6fbd0) at ../../gdb/valops.c:1385 #3 0x0000555555708151 in evaluate_var_value (noside=3DEVAL_NORMAL, blk=3D, var=3D0x7ffff6af8030) at ../../gdb/eval.c:559 #4 0x000055555570a342 in expression::evaluate (this=3D0x7ffff6afad90, expect_type=3Dexpect_type@entry=3D0x0,=20 noside=3Dnoside@entry=3DEVAL_NORMAL) at ../../gdb/eval.c:101 #5 0x000055555570a3b2 in evaluate_expression (exp=3D, expect_type=3Dexpect_type@entry=3D0x0) at ../../gdb/eval.c:115 #6 0x0000555555848add in process_print_command_args (args=3D, print_opts=3Dprint_opts@entry=3D0x7fffffffe00c,=20 voidprint=3Dvoidprint@entry=3Dtrue) at /usr/include/c++/12.2.1/bits/unique_ptr.h:191 #7 0x0000555555848eb5 in print_command_1 (args=3D, voidprin= t=3D1) at ../../gdb/printcmd.c:1319 #8 0x0000555555670b63 in cmd_func (cmd=3D0x7ffff745ccd0, args=3D0x7ffff6a8= 10d2 "BCSCTL1", from_tty=3D1) at ../../gdb/cli/cli-decode.c:2543 #9 0x000055555597c377 in execute_command (p=3D, p@entry=3D0x7ffff6a810d0 "p BCSCTL1", from_tty=3D1) at ../../gdb/top.c:688 #10 0x000055555570c75e in command_handler (command=3D0x7ffff6a810d0 "p BCSC= TL1") at ../../gdb/event-top.c:616 #11 0x000055555570d4aa in command_line_handler (rl=3D...) at ../../gdb/event-top.c:852 #12 0x000055555570cf8c in gdb_rl_callback_handler (rl=3D0x7ffff6a810a0 "p BCSCTL1") at ../../gdb/event-top.c:246 #13 0x00007ffff7ddf2d5 in rl_callback_read_char () from /usr/lib/libreadline.so.8 #14 0x000055555570d042 in gdb_rl_callback_read_char_wrapper_noexcept () at ../../gdb/event-top.c:188 #15 0x000055555570d0e8 in gdb_rl_callback_read_char_wrapper (client_data=3D) at ../../gdb/event-top.c:221 #16 0x000055555570c689 in stdin_event_handler (error=3D, client_data=3D0x7ffff7f3cea0) at ../../gdb/event-top.c:541 #17 0x0000555555d60b0a in gdb_wait_for_event (block=3D) at ../../gdbsupport/event-loop.cc:716 #18 gdb_wait_for_event (block=3D) at ../../gdbsupport/event-loop.cc:585 #19 0x0000555555d612b7 in gdb_do_one_event (mstimeout=3Dmstimeout@entry=3D-= 1) at ../../gdbsupport/event-loop.cc:264 #20 0x00005555557bed41 in start_event_loop () at ../../gdb/main.c:411 #21 captured_command_loop () at ../../gdb/main.c:471 #22 0x00005555557c0474 in captured_main (data=3Ddata@entry=3D0x7fffffffe460= ) at ../../gdb/main.c:1330 #23 gdb_main (args=3Dargs@entry=3D0x7fffffffe490) at ../../gdb/main.c:1345 #24 0x0000555555595ff6 in main (argc=3D, argv=3D) at ../../gdb/gdb.c:32 Specifically, the issue is in gdb/findvar.c at: =E2=94=82 753 /* Relocate address, unless there is no section= or the variable is =E2=94=82 754 a TLS variable. */ =E2=94=82 755 if (obj_section =3D=3D NULL =E2=94=82 > 756 || (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) !=3D 0) =E2=94=82 757 addr =3D bmsym.minsym->value_raw_address (); =E2=94=82 758 else =E2=94=82 759 addr =3D bmsym.value_address (); (gdb) p *obj_section $7 =3D {the_bfd_section =3D 0x0, objfile =3D 0x0, ovly_mapped =3D 0} --=20 You are receiving this mail because: You are on the CC list for the bug.=