public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29941] New: Inferior call strlen(p) gives segfaults in GDB 13,  (somewhat?) works in GDB11 and GDB12
@ 2022-12-25 20:47 philippe.waroquiers at skynet dot be
  2022-12-25 23:37 ` [Bug gdb/29941] " mark at klomp dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: philippe.waroquiers at skynet dot be @ 2022-12-25 20:47 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29941
           Summary: Inferior call strlen(p) gives segfaults in GDB 13,
                    (somewhat?) works in GDB11 and GDB12
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: philippe.waroquiers at skynet dot be
  Target Milestone: ---

Compile the below with gcc -g -o m m.c


#include <string.h>
int main()
{
  char p[10];
  p[0] = 'a';
  p[1] = 0;
  return strlen(p);
}

gdb --nx ./m --ex 'b 7' --ex 'run' --ex 'print strlen(p)' --ex 'continue' --ex
quit

With GDB 11.1, it sometimes works, sometimes gives Aborted
but seems to work when the print strlen is done interactive.

With GDB 12.1, same behaviour

With GDB 13.0.50.20221218, it systematically gives a segfault.
(stacktrace given below).



Fatal signal: Segmentation fault
----- Backtrace -----
0x55adb64e7159 gdb_internal_backtrace_1
        ../../gdb-13.0.50.20221218/gdb/bt-utils.c:122
0x55adb64e7159 _Z22gdb_internal_backtracev
        ../../gdb-13.0.50.20221218/gdb/bt-utils.c:168
0x55adb65fef8f handle_fatal_signal
        ../../gdb-13.0.50.20221218/gdb/event-top.c:956
0x55adb65ff0fe handle_sigsegv
        ../../gdb-13.0.50.20221218/gdb/event-top.c:1029
0x7fb88929b13f ???
        ./nptl/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x55adb66226bf _Z14get_frame_arch14frame_info_ptr
        ../../gdb-13.0.50.20221218/gdb/frame.c:2909
0x55adb6623c75 _Z12get_frame_sp14frame_info_ptr
        ../../gdb-13.0.50.20221218/gdb/frame.c:2997
0x55adb6665eb8
_Z27call_function_by_hand_dummyP5valueP4typeN3gdb10array_viewIS0_EEPFvPviES6_
        ../../gdb-13.0.50.20221218/gdb/infcall.c:898
0x55adb65fc940
_ZN4expr9operation16evaluate_funcallEP4typeP10expression6nosidePKcRKSt6vectorISt10unique_ptrIS0_St14default_deleteIS0_EESaISC_EE
        ../../gdb-13.0.50.20221218/gdb/eval.c:702
0x55adb65f914d _ZN10expression8evaluateEP4type6noside
        ../../gdb-13.0.50.20221218/gdb/eval.c:101
0x55adb67359ff process_print_command_args
        ../../gdb-13.0.50.20221218/gdb/printcmd.c:1306
0x55adb6735eae print_command_1
        ../../gdb-13.0.50.20221218/gdb/printcmd.c:1319
0x55adb651abc4 _Z8cmd_funcP16cmd_list_elementPKci
        ../../gdb-13.0.50.20221218/gdb/cli/cli-decode.c:2543
0x55adb6861541 _Z15execute_commandPKci
        ../../gdb-13.0.50.20221218/gdb/top.c:693
0x55adb66d4e75 catch_command_errors
        ../../gdb-13.0.50.20221218/gdb/main.c:513
0x55adb66d4f41 execute_cmdargs
        ../../gdb-13.0.50.20221218/gdb/main.c:608
0x55adb66d65a4 captured_main_1
        ../../gdb-13.0.50.20221218/gdb/main.c:1299
0x55adb66d717a captured_main
        ../../gdb-13.0.50.20221218/gdb/main.c:1320
0x55adb66d717a _Z8gdb_mainP18captured_main_args
        ../../gdb-13.0.50.20221218/gdb/main.c:1345
0x55adb642cdfb main
        ../../gdb-13.0.50.20221218/gdb/gdb.c:32

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-03 10:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-25 20:47 [Bug gdb/29941] New: Inferior call strlen(p) gives segfaults in GDB 13, (somewhat?) works in GDB11 and GDB12 philippe.waroquiers at skynet dot be
2022-12-25 23:37 ` [Bug gdb/29941] " mark at klomp dot org
2022-12-26  7:39 ` vries at gcc dot gnu.org
2022-12-26 12:59 ` aburgess at redhat dot com
2022-12-26 13:08 ` vries at gcc dot gnu.org
2023-01-03  9:18 ` cvs-commit at gcc dot gnu.org
2023-01-03 10:53 ` cvs-commit at gcc dot gnu.org

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).