GNU bug report logs - #40279
26.3; Error: you did not specify -i=mi on GDB's command line!

Previous Next

Package: emacs;

Reported by: Roland Coeurjoly <rolandcoeurjoly <at> gmail.com>

Date: Sun, 29 Mar 2020 17:12:02 UTC

Severity: normal

Tags: moreinfo

Merged with 28309

Found in version 26.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Roland Coeurjoly <rolandcoeurjoly <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 40279 <at> debbugs.gnu.org
Subject: bug#40279: 26.3; Error: you did not specify -i=mi on GDB's command line!
Date: Mon, 26 Oct 2020 21:31:25 +0100
[Message part 1 (text/plain, inline)]
Yes, the problem is that it doesn't split the frame in different windows,
and nothing good happens.

I need to run gdb inside Docker, and I have a strong preference for the
interface provided by emacs.

When doing M-x gdb, I enter "docker-compose -f
~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb
-i=mi"", and then it shows me the following message.

Current directory is /home/drcoeurjoly/docker-services/dev/

Error: you did not specify -i=mi on GDB's command line! WARNING: The MY_UID
variable is not set. Defaulting to a blank string.

1-inferior-tty-set /dev/pts/3

2-gdb-set height 0

3-gdb-set non-stop 1

4-enable-pretty-printing

5-file-list-exec-source-files

6-file-list-exec-source-file

7-gdb-show prompt

8-stack-info-frame

9-thread-info

10-break-list

11-thread-info

12-break-list

=thread-group-added,id="i1"

~"GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7\n"

~"Copyright (C) 2013 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. Type \"show copying\"\nand \"show warranty\" for details.\n"

~"This GDB was configured as \"x86_64-redhat-linux-gnu\".\nFor bug
reporting instructions, please see:\n"

~"http://www.gnu.org/software/gdb/bugs/.\n"

=cmd-param-changed,param="history save",value="on"

=cmd-param-changed,param="history
filename",value="/home/drcoeurjoly/dotfiles/gdb/.gdb_history"

=cmd-param-changed,param="print pretty",value="on"

=cmd-param-changed,param="print object",value="on"

=cmd-param-changed,param="print vtbl",value="on"

=cmd-param-changed,param="demangle-style",value="gnu-v3"

=cmd-param-changed,param="follow-fork-mode",value="child"

=cmd-param-changed,param="detach-on-fork",value="off"

(gdb)

1^done

(gdb)

2^done

(gdb)

3^done

(gdb)

4^done

(gdb)

5^done,files=[]

(gdb)

6^error,msg="No symbol table is loaded. Use the \"file\" command."

(gdb)

7^done,value="(gdb) "

(gdb)

8^error,msg="No registers."

(gdb)

9^done,threads=[]

(gdb)

10^done,BreakpointTable={nr_rows="0",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[]}

(gdb)

11^done,threads=[]

(gdb)

12^done,BreakpointTable={nr_rows="0",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[]}

(gdb)

Note that I successfully enter gdb in Docker, since GDB says:

"GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7\n"

In my host operating system (Debian): gdb --version outputs:

GNU gdb (Debian 8.2.1-2+b3) 8.2.1

In Debian, I execute the Docker command: docker-compose -f
~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb -i=mi"
and I get the machine-oriented text interface.

From the previous test I deduce that it is an issue of emacs, not Docker.

When entering the path of a binary instead of the option -i=mi, it reads
the symbols just fine: M-x gdb RETURN docker-compose -f
~/docker-services/dev/docker-compose.yml exec dev_rhel7 bash -c "gdb
~/babel_sandbox/build/foo" which outputs:

Current directory is /home/drcoeurjoly/docker-services/dev/

Error: you did not specify -i=mi on GDB's command line!

WARNING: The MY_UID variable is not set. Defaulting to a blank string.

1-inferior-tty-set /dev/pts/3

2-gdb-set height 0

3-gdb-set non-stop 1

4-enable-pretty-printing

5-file-list-exec-source-files

6-file-list-exec-source-file

7-gdb-show prompt

8-stack-info-frame

9-thread-info

10-break-list

11-thread-info

12-break-list

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.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/...

Reading symbols from /home/drcoeurjoly/babel_sandbox/build/foo...done.

(gdb) 1-inferior-tty-set /dev/pts/3

Undefined command: "1-inferior-tty-set". Try "help".

(gdb) 2-gdb-set height 0

Undefined command: "2-gdb-set". Try "help".

(gdb) 3-gdb-set non-stop 1

Undefined command: "3-gdb-set". Try "help".

(gdb) 4-enable-pretty-printing

Undefined command: "4-enable-pretty-printing". Try "help".

(gdb) 5-file-list-exec-source-files

Undefined command: "5-file-list-exec-source-files". Try "help".

(gdb) 6-file-list-exec-source-file

Undefined command: "6-file-list-exec-source-file". Try "help".

(gdb) 7-gdb-show prompt

Undefined command: "7-gdb-show". Try "help".

(gdb) 8-stack-info-frame

Undefined command: "8-stack-info-frame". Try "help".

(gdb) 9-thread-info

Undefined command: "9-thread-info". Try "help".

(gdb) 10-break-list

Undefined command: "10-break-list". Try "help".

(gdb) 11-thread-info

Undefined command: "11-thread-info". Try "help".

(gdb) 12-break-list

Undefined command: "12-break-list". Try "help".

(gdb)

I also tried putting the gdb -i=mi inside a script and calling that from
emacs, to no avail. Calling directly from bash worked and not from emacs.

Relevant information:

   - My spacemacs config <https://github.com/RCoeurjoly/dotfiles>
   - foo program <https://github.com/RCoeurjoly/babel_sandbox/> used for
   testing argument passing to gdb in emacs.

I don't know if the dockerfile and docker-compose yml are relevant. If so,
I will create a repo.

Versions:

Host: uname -a

Linux des26 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)
x86_64 GNU/Linux

Emacs in host: emacs --version

GNU Emacs 26.3

GDB in host: gdb --version

GNU gdb (Debian 8.2.1-2+b3) 8.2.1

Docker in host: docker --version

Docker version 18.09.1, build 4c52b90

Docker-compose in host: docker-compose --version

docker-compose version 1.21.0, build unknown

Docker container: cat /etc/redhat-release

CentOS Linux release 7.5.1804 (Core)

GDB in docker container: gdb --version

GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-114.el7

This issue was reported by Robert Mecklenburg here
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2017-08/msg01216.html>
and here
<https://forums.docker.com/t/emacs-gud-mode-fails-with-docker-gdb/37452> as
early as august 2017.

On Mon, Oct 26, 2020 at 3:19 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Roland Coeurjoly <rolandcoeurjoly <at> gmail.com> writes:
>
> > When I try to run:
> > M-x gdb <RET> docker-compose -f ~/docker-services/dev/docker-compose.yml
> > exec dev_rhel7 bash -c "gdb -i=mi" <RET>
> > I get the following error:
> > Error: you did not specify -i=mi on GDB's command line!
>
> I don't know docker, but this is a message Emacs gives when gdb doesn't
> start up and output the data that knows that it has been started
> correctly.
>
> So the message may be slightly misleading, but the problem seems to be
> that gdb isn't started properly?  Here's the code:
>
> (defun gdb--check-interpreter (filter proc string)
>   (unless (zerop (length string))
>     (remove-function (process-filter proc) #'gdb--check-interpreter)
>     (unless (memq (aref string 0) '(?^ ?~ ?@ ?& ?* ?=))
>       ;; Apparently we're not running with -i=mi.
>       (let ((msg "Error: you did not specify -i=mi on GDB's command
> line!"))
>
> So is there a problem with your gdb invocation via docker?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

This bug report was last modified 4 years and 202 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.