Package: emacs;
Reported by: Vladimir Nikishkin <lockywolf <at> gmail.com>
Date: Sat, 28 Mar 2020 11:53:02 UTC
Severity: minor
Found in version 26.3
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Vladimir Nikishkin <lockywolf <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 40271 <at> debbugs.gnu.org Subject: bug#40271: 26.3; gdb-mode fails to initialize if the target executable is built without symbols Date: Sat, 28 Mar 2020 21:26:12 +0800
Sorry, I misunderstood you. lockywolf <at> delllaptop:~$ gdb -i=mi a.out =thread-group-added,id="i1" ~"GNU gdb (GDB) 9.1\n" ~"Copyright (C) 2020 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law." ~"\nType \"show copying\" and \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-slackware-linux\".\n" ~"Type \"show configuration\" for configuration details.\n" ~"For bug reporting instructions, please see:\n" ~"<http://www.gnu.org/software/gdb/bugs/>.\n" ~"Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>." ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\"...\n" =cmd-param-changed,param="logging file",value="/home/lockywolf/gdb-log.log" =cmd-param-changed,param="print pretty",value="on" =cmd-param-changed,param="print array-indexes",value="on" =cmd-param-changed,param="print array",value="on" =cmd-param-changed,param="print symbol-filename",value="on" =cmd-param-changed,param="print object",value="on" =cmd-param-changed,param="print vtbl",value="on" =cmd-param-changed,param="history save",value="on" ~"Reading symbols from a.out...\n" (gdb) -file-list-exec-source-file ^done,line="1",file="../sysdeps/x86_64/start.S",fullname="/root/glibc-2a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S",macro-info="0" (gdb) I am confused, because libc is also expected to be stripped. Is this a gdb bug? Frankly speaking, I just found this by mistake. I forgot to issue -ggdb when compiling my code. I'm not a reverse engineer. What to do... well, I am not an expert, but the opposite case, that is when non-stripped code calls a stripped code function and encounters and exception, certainly is handled some way. Maybe gdb-mode can say something like "the most recent known file is claimed (by the code) to be /root/blah.S, but this file is also missing (just as your debugging symbols)". GDB itself does something like this: (gdb) list 1 ../sysdeps/x86_64/start.S: No such file or directory. In a perfect world it could ask for an external source address, but perhaps this is an overkill сб, 28 мар. 2020 г. в 21:12, Eli Zaretskii <eliz <at> gnu.org>: > > [Please keep the bug address on the CC line, so that this discussion > gets recorded by the Emacs issue tracker.] > > > From: Vladimir Nikishkin <lockywolf <at> gmail.com> > > Date: Sat, 28 Mar 2020 20:38:50 +0800 > > > > I am not super sure how to debug this. > > > > Firsly, regarding your question: > > > > lockywolf <at> delllaptop:~/DevLinux/chibi-sicp$ gdb -i=mi a.out > > =thread-group-added,id="i1" > > ~"GNU gdb (GDB) 9.1\n" > > ~"Copyright (C) 2020 Free Software Foundation, Inc.\n" > > ~"License GPLv3+: GNU GPL version 3 or later > > <http://gnu.org/licenses/gpl.html>\nThis is free software: you are > > free to change and redistribute it.\nThere is NO WARRANTY, to the > > extent permitted by law." > > ~"\nType \"show copying\" and \"show warranty\" for details.\n" > > ~"This GDB was configured as \"x86_64-slackware-linux\".\n" > > ~"Type \"show configuration\" for configuration details.\n" > > ~"For bug reporting instructions, please see:\n" > > ~"<http://www.gnu.org/software/gdb/bugs/>.\n" > > ~"Find the GDB manual and other documentation resources online at:\n > > <http://www.gnu.org/software/gdb/documentation/>." > > ~"\n\n" > > ~"For help, type \"help\".\n" > > ~"Type \"apropos word\" to search for commands related to \"word\"...\n" > > =cmd-param-changed,param="logging file",value="/home/lockywolf/gdb-log.log" > > =cmd-param-changed,param="print pretty",value="on" > > =cmd-param-changed,param="print array-indexes",value="on" > > =cmd-param-changed,param="print array",value="on" > > =cmd-param-changed,param="print symbol-filename",value="on" > > =cmd-param-changed,param="print object",value="on" > > =cmd-param-changed,param="print vtbl",value="on" > > =cmd-param-changed,param="history save",value="on" > > ~"Reading symbols from a.out...\n" > > (gdb) > > > > Secondly: > > The place where gdb-mode fail, IMO, is line 4688 in the gdb-mi.el, > > function gdb-get-source-file > > I inserted (write-file "/home/lockywolf/debugging-buffer.txt") right > > after (goto-char (min-point)), and the contents of the file are: > > lockywolf <at> delllaptop:~$ cat debugging-buffer.1.txt > > line="1",file="../sysdeps/x86_64/start.S",fullname="/root/glibc-2a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S",macro-info="0" > > > > /root/glibc-* is the place where Slackware developers compile glibc. > > Doesn't seem like the correct file. The correct file is called > > "second.f90", and is in the same directory. > > That seems to be the problem: in my case I get an error message: > > (gdb) > -file-list-exec-source-file > ^error,msg="No symbol table is loaded. Use the \"file\" command." > > which is quite expected. > > So I guess the problem is that your program is stripped, but the > standard C library isn't. What do you suggest Emacs should do in this > case? How can it know that the source file it's been fed isn't the > right one? > > More generally, what is the use case where you want to debug a > stripped program in gdb-mi? why did you strip the program in the first > place? -- Yours sincerely, Vladimir Nikishkin
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.