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:27:24 +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="126563"; 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:28:18 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 1jIBVa-000WqU-QI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Mar 2020 14:28:18 +0100 Original-Received: from localhost ([::1]:53150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIBVZ-0007Gx-Ra for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Mar 2020 09:28:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56901) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIBVL-0007D0-SQ for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIBVK-0000Mf-7B for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:28:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56023) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jIBVK-0000MK-2o for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jIBVJ-0004xM-VO for bug-gnu-emacs@gnu.org; Sat, 28 Mar 2020 09:28:01 -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:28: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.158540206719023 (code B ref 40271); Sat, 28 Mar 2020 13:28:01 +0000 Original-Received: (at 40271) by debbugs.gnu.org; 28 Mar 2020 13:27:47 +0000 Original-Received: from localhost ([127.0.0.1]:33762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIBV4-0004wk-Nn for submit@debbugs.gnu.org; Sat, 28 Mar 2020 09:27:47 -0400 Original-Received: from mail-ed1-f46.google.com ([209.85.208.46]:33332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIBV2-0004wU-LJ for 40271@debbugs.gnu.org; Sat, 28 Mar 2020 09:27:45 -0400 Original-Received: by mail-ed1-f46.google.com with SMTP id z65so15014303ede.0 for <40271@debbugs.gnu.org>; Sat, 28 Mar 2020 06:27:44 -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=E5VN/uec27qbHxPjQKmDvox8+Unn9Ebi10a1eN/wz1Q=; b=ZByvl8rRlVsHIY9lEk8maYsOewHJM5nxrqyIOGyHEEPsOAcM5wxQghPvms8K3cnyPi +JlsoWMioT7LJA3sytvSCH83IRuVktzPKWMxvqo2ycdtxyVdpJW2FCCDZphjko7zwAUC khGDUQdAg7vkm6/Im4eh2eZXh7Vupo7bFmoLwQAXmCaVyE8d+2ME3CIZe8x6MgtZ6Htv GoQVmTK9dAzpCz7f7raHtVSsCj3hNf817/Qv1RhIVrd/Zg1OTGoga20EKtrbCD0KfoFx h85tqIcnaWsj35XzBk9xG1kWRMQ1zrHkDc22wPS3mvmLDAhR/Nx1D9q/tTU8W6+DDlpM Skaw== 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=E5VN/uec27qbHxPjQKmDvox8+Unn9Ebi10a1eN/wz1Q=; b=nd+s8ry1OiUHRvTY0wLzl7WvgqTkLqZzEvRtKu6PApTqy715sno1g2jyptd22t/MTY AAQDMpi91udIVZ5yybchAd2CXXv8u0pNtG8R1zgRvflBsEMpXutYxzhpnqMz67I7s8CY 8MIFqnoCpgA9AQxq40JVMOGg3cpVo4fW7AT+vrXWOf27Th96YLzb5fpj2M82fDdE0ocj nRYtPL8i5M5qtkOJYq1NHyptM85oOzzmNPe7gE87HzZXjnMx+Uaxef4EKrHRiAw9nWHr S/s2UfB5DnEjON+RXSAVxXjfx62m1g1NslYMX7SU1oBSIDs+UovITcs0S3UtvP7ZYA+T t5zg== X-Gm-Message-State: ANhLgQ2IPEjkW3SpBF2y4KoRASqUrq8AANKNh7YuJUDVHqWWAHTpMbOo SIGZiJ8i+/n/oVR3hzcKFhzQOKxSn09WIQ5tYMqfdQ== X-Google-Smtp-Source: ADFU+vumBTqIryanqGgd6vvv+eaQZnYmIz82O4qsGDoZ7lbIoyhI3IEct9cwnnm9t6tdC27HRCOhe70szoXcK9W/gCc= X-Received: by 2002:a17:906:1e4a:: with SMTP id i10mr3396788ejj.169.1585402058839; Sat, 28 Mar 2020 06:27:38 -0700 (PDT) In-Reply-To: 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:177811 Archived-At: I, personaly, would be happy with just a friendlier error message. =D1=81=D0=B1, 28 =D0=BC=D0=B0=D1=80. 2020 =D0=B3. =D0=B2 21:26, Vladimir Ni= kishkin : > > 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-= 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) > -file-list-exec-source-file > ^done,line=3D"1",file=3D"../sysdeps/x86_64/start.S",fullname=3D"/root/gli= bc-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 gd= b 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 Zaret= skii : > > > > [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/= gdb-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= -2a0c65c5167af50893952729ba38cc68/glibc-2.30/csu/../sysdeps/x86_64/start.S"= ,macro-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? > > > > -- > Yours sincerely, Vladimir Nikishkin --=20 Yours sincerely, Vladimir Nikishkin