Subject: bug#40271: Fwd: bug#40271: 26.3; gdb-mode fails to initialize if the target executable is built without symbols

From: Vladimir Nikishkin <[email-masked]>
Date: Sat, 28 Mar 2020 20:39:34 +0800

---------- Forwarded message ---------
От: Vladimir Nikishkin <[email-masked]>
Date: сб, 28 мар. 2020 г. в 20:38
Subject: Re: bug#40271: 26.3; gdb-mode fails to initialize if the
target executable is built without symbols
To: Eli Zaretskii <[email-masked]>

I am not super sure how to debug this.

Firsly, regarding your question:

lockywolf@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@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.

сб, 28 мар. 2020 г. в 20:30, Eli Zaretskii <[email-masked]>:
>
> > Date: Sat, 28 Mar 2020 15:11:27 +0300
> > From: Eli Zaretskii <[email-masked]>
> > Cc: [email-masked]
> >
> > > From: Vladimir Nikishkin <[email-masked]>
> > > Date: Sat, 28 Mar 2020 19:51:40 +0800
> > >
> > > The way to reproduce would be the following:
> > > 1)printf "program main\nend" > test.f90
> > > 2)gfortran test.f90
> > > 3)emacs -q
> > > 4)M-: (setq gdb-many-windows t) RET
> > > 5)gdb RET a.out RET
> > >
> > > Observe that gdb-mode fails to initialize.
> >
> > I cannot reproduce this on my system, debugging one of the programs in
> > the public /usr/bin/ directory (which are all stripped of the
> > debugging symbols).
> >
> > > This happens because in gdb-mi.el.gz, line 4689, gdb-main-file gets
> > > a completely unrelated .S file name relative to the directory where
> > > distro authors compile glibc.
> >
> > Please show all the related details (what regexp search fails, what
> > does it find, and what it ought to find instead), since otherwise it
> > will be very hard to fix this problem.
>
> Also, if you start GDB from the shell prompt, like this:
>
>   $ gdb -i=mi ./a.out
>
> and then issue the -file-list-exec-source-file command, what do you
> see?

-- 
Yours sincerely, Vladimir Nikishkin

-- 
Yours sincerely, Vladimir Nikishkin