From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Vladimir Nikishkin Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87mu80k88j.fsf@delllaptop.lockywolf.net> <83mu807k7k.fsf@gnu.org> <83k1347jc3.fsf@gnu.org> <83eetc7hdd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="122286"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40271@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 28 14:27:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIBUX-000Vfv-Tg for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Mar 2020 14:27:14 +0100 Original-Received: from localhost ([::1]:53136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIBUW-0006tM-Fm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Mar 2020 09:27:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56791) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIBUN-0006tF-TD for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:27:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIBUM-0007Da-92 for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jIBUM-0007Ct-55 for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jIBUM-0004vZ-0u for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vladimir Nikishkin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Mar 2020 13:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40271 X-GNU-PR-Package: emacs Original-Received: via spool by 40271-submit@debbugs.gnu.org id=B40271.158540199318901 (code B ref 40271); Sat, 28 Mar 2020 13:27:01 +0000 Original-Received: (at 40271) by debbugs.gnu.org; 28 Mar 2020 13:26:33 +0000 Original-Received: from localhost ([127.0.0.1]:33758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIBTt-0004um-0e for submit@debbugs.gnu.org; Sat, 28 Mar 2020 09:26:33 -0400 Original-Received: from mail-ed1-f42.google.com ([209.85.208.42]:44127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIBTq-0004uW-NL for 40271@debbugs.gnu.org; Sat, 28 Mar 2020 09:26:31 -0400 Original-Received: by mail-ed1-f42.google.com with SMTP id i16so14017355edy.11 for <40271@debbugs.gnu.org>; Sat, 28 Mar 2020 06:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=iPu45HO+K6nj0IzhKecRcGZX4I9ZUOdT7r5tsVtdxEY=; b=fuufaEujkFZ9/+uTDDbU3wGQz2ExrG9JGQ4K9TZC4VgQFB59IHpiBjCTU5BB2bjWYE FDC6W07QaATrisImIXIL2zplf6V1p9m6VN5tk3QGRCC05r8TET0vkZUTPyg3Df0EIecG jCZKcznY9SmrpPT1Ic8+5NEcwYzx6uMhnYIE887lMePRuskDXNTEQ7NBaboSWuNDFeP+ reHgK43uIjMNqNQFE/MuzmQ75LW+c8/7OvVNTlbDcxZywRTGtuGlRgMGMf2wPmqM+7vK zX4l0mFYQFfK7+3i2giD51//NQ8Z6e4nSK6BXDyWDL8R/JGJuhgXlI4C7i4+gIaYCXPF u8gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=iPu45HO+K6nj0IzhKecRcGZX4I9ZUOdT7r5tsVtdxEY=; b=spyNGJdU3TxcW18dWlpaDezjuON+LGDgh5mtpAM06Anh1i7qbgLZQnOm1OgtkHnGjr 4VsqGQ8TYVr6neSVzKsjhPV0EWdw+j/eyneYZ7SGYERi184Sud7e8XNiy8FfocwJoCNZ yC/LHs5URmv5Ucxy8HM3gyjoMKaLpWifVwv5zJbRsVZRcrsV6FyOkAIK3FuHEhCADUqt LVuQifIvXJsQSSM+hhvZAOdybWuGiWumi7ELnFvgwreKZiHUp7YkSegFu5euAbvZvPKq SCSDX8IYSPhfpl7flVJyLXtsPTDW3y14xl+OEbkVEUnHONRPqQrkCo5yy+nSrwewfoa6 3Nrw== X-Gm-Message-State: ANhLgQ3eVbzZGT9EIefdNvoj/3iFFr6JVpHNHf5JUPCcbrVZGegyhL/d MT4iJu0Jz5fnGnkfJTyQirsgx9mYvXxOqm4j6Q8= X-Google-Smtp-Source: ADFU+vuV5F5Kkl9qKGy2yq+tr/4JN/P+LSwWFI/lHw5cfZ4leUnpXie8t0KYcs413IvHtA4gOZqkLnFnndkjDfqn8hw= X-Received: by 2002:a50:8e08:: with SMTP id 8mr3709808edw.153.1585401984720; Sat, 28 Mar 2020 06:26:24 -0700 (PDT) In-Reply-To: <83eetc7hdd.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177810 Archived-At: Sorry, I misunderstood you. lockywolf@delllaptop:~$ gdb -i=3Dmi a.out =3Dthread-group-added,id=3D"i1" ~"GNU gdb (GDB) 9.1\n" ~"Copyright (C) 2020 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later \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" ~".\n" ~"Find the GDB manual and other documentation resources online at:\n ." ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\"...\n" =3Dcmd-param-changed,param=3D"logging file",value=3D"/home/lockywolf/gdb-lo= g.log" =3Dcmd-param-changed,param=3D"print pretty",value=3D"on" =3Dcmd-param-changed,param=3D"print array-indexes",value=3D"on" =3Dcmd-param-changed,param=3D"print array",value=3D"on" =3Dcmd-param-changed,param=3D"print symbol-filename",value=3D"on" =3Dcmd-param-changed,param=3D"print object",value=3D"on" =3Dcmd-param-changed,param=3D"print vtbl",value=3D"on" =3Dcmd-param-changed,param=3D"history save",value=3D"on" ~"Reading symbols from a.out...\n" (gdb) -file-list-exec-source-file ^done,line=3D"1",file=3D"../sysdeps/x86_64/start.S",fullname=3D"/root/glibc= -2a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S"= ,macro-info=3D"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 =D1=81=D0=B1, 28 =D0=BC=D0=B0=D1=80. 2020 =D0=B3. =D0=B2 21:12, Eli Zaretsk= ii : > > [Please keep the bug address on the CC line, so that this discussion > gets recorded by the Emacs issue tracker.] > > > From: Vladimir Nikishkin > > Date: Sat, 28 Mar 2020 20:38:50 +0800 > > > > I am not super sure how to debug this. > > > > Firsly, regarding your question: > > > > lockywolf@delllaptop:~/DevLinux/chibi-sicp$ gdb -i=3Dmi a.out > > =3Dthread-group-added,id=3D"i1" > > ~"GNU gdb (GDB) 9.1\n" > > ~"Copyright (C) 2020 Free Software Foundation, Inc.\n" > > ~"License GPLv3+: GNU GPL version 3 or later > > \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" > > ~".\n" > > ~"Find the GDB manual and other documentation resources online at:\n > > ." > > ~"\n\n" > > ~"For help, type \"help\".\n" > > ~"Type \"apropos word\" to search for commands related to \"word\"...\n= " > > =3Dcmd-param-changed,param=3D"logging file",value=3D"/home/lockywolf/gd= b-log.log" > > =3Dcmd-param-changed,param=3D"print pretty",value=3D"on" > > =3Dcmd-param-changed,param=3D"print array-indexes",value=3D"on" > > =3Dcmd-param-changed,param=3D"print array",value=3D"on" > > =3Dcmd-param-changed,param=3D"print symbol-filename",value=3D"on" > > =3Dcmd-param-changed,param=3D"print object",value=3D"on" > > =3Dcmd-param-changed,param=3D"print vtbl",value=3D"on" > > =3Dcmd-param-changed,param=3D"history save",value=3D"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=3D"1",file=3D"../sysdeps/x86_64/start.S",fullname=3D"/root/glibc-2= a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S",m= acro-info=3D"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=3D"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? --=20 Yours sincerely, Vladimir Nikishkin