all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roland Coeurjoly <rolandcoeurjoly@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 40279@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	[thread overview]
Message-ID: <CAMdauZo0VZ=AaRcgvc8AWa49ccdosE4ZsqMq_Y1wf-Qa9MHdQA@mail.gmail.com> (raw)
In-Reply-To: <87ft61134a.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 8453 bytes --]

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@gnus.org> wrote:

> Roland Coeurjoly <rolandcoeurjoly@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
>

[-- Attachment #2: Type: text/html, Size: 12587 bytes --]

  reply	other threads:[~2020-10-26 20:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29  7:21 bug#40279: 26.3; Error: you did not specify -i=mi on GDB's command line! Roland Coeurjoly
2020-10-26 14:19 ` Lars Ingebrigtsen
2020-10-26 20:31   ` Roland Coeurjoly [this message]
2020-10-26 21:01     ` Lars Ingebrigtsen
2020-10-26 21:07       ` Roland Coeurjoly
2020-10-27  7:46         ` Lars Ingebrigtsen
2020-10-27 18:36     ` William Xu
2020-10-27 19:14       ` Lars Ingebrigtsen
2020-10-27 20:04         ` William Xu
2020-10-27 20:11           ` Lars Ingebrigtsen
2020-10-28 19:48             ` William Xu
2020-10-30 12:19               ` Lars Ingebrigtsen
2020-10-30 16:29                 ` William Xu
2020-10-27 20:20           ` Eli Zaretskii
2020-10-27 20:09         ` Eli Zaretskii
2020-11-03 18:52     ` William Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMdauZo0VZ=AaRcgvc8AWa49ccdosE4ZsqMq_Y1wf-Qa9MHdQA@mail.gmail.com' \
    --to=rolandcoeurjoly@gmail.com \
    --cc=40279@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.