Created attachment 9466 [details] source and makefile, backtrace, and GNUstep install instructions Component: GDB (7.11.1) OS: Windows Server (2008 R2) + MINGW32 (20160205) Language: Objective C + GNUstep Summary: Creating an NSString convenience variable crashes GDB. Creating a C string convenience variable causes an error. Steps to Reproduce: Create the simplest imaginable GNUstep tool and build it and gdb it. (gdb) b main (gdb) r (gdb) p $a = "foo" # char * convenience var $3 = <error reading variable> # unexpected, instead of "foo" (gdb) set $b = @"bar" # NSString convenience var Segmentation fault # unexpected, instead of @"bar" Debugger exited abnormally with code 5 Observation: strdata=0, len=99243256 at memcpy in write_exp_string at parse.c:372 Attachments: backtrace.txt, mytool.m, GNUmakefile, gnustep-install.txt
IMPORTANT: Just realized: you do not need GNUstep to reproduce the problem. Steps to Reproduce: % gdb -nx (gdb) set lang objective-c (gdb) p "foo" $1 = <error reading variable> # error reading a c string (gdb) p @"foo" # crash reading an NSString
I just confirmed that this bug is also in 64bit GDB 7.6.1 on Linux: % gdb -nx GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb) set lang objective-c (gdb) p "foo" $1 = <error reading variable> (gdb) p @"foo" Segmentation fault (core dumped)
GNU gdb 6.8 i686-pc-mingw32 .................... does not have the bug GNU gdb 7.3.1 mingw32 .......................... does not have the bug GNU gdb 7.6.1-80.el7 x86_64-redhat-linux-gnu ... has the bug GNU gdb 7.11.1 i686-w64-mingw32 ................ has the bug GNU gdb 7.11.1 x86_64-w64-mingw32 .............. has the bug
This bug has been completely fixed by this patch: https://sourceware.org/ml/gdb-patches/2016-09/msg00100.html