From: "Juan José García-Ripoll" <juanjose.garciaripoll@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: gdb fails to flush output (msys2)
Date: Mon, 14 Mar 2022 18:55:55 +0100 [thread overview]
Message-ID: <867d8wa05w.fsf@csic.es> (raw)
In-Reply-To: 83o828k6a7.fsf@gnu.org
Eli Zaretskii <eliz@gnu.org> writes:
>> I am trying to debug some programs on Windows using MSYS2.
>
> What do you mean by "using MSYS2" here?
MSYS2 is the open source software distribution that replaces cygwin in
providing a unix-like experience in Windows. I am using MSYS2 and the
Mingw64, UCRT64 and Clang-based toolchains to develop, compile and now
debug software.
>> In doing so, I noticed that the gdb mode is not working well with
>> the output from the debugger.
>
> By "gdb mode", do you mean the result of "M-x gdb", followed by
> specifying the GDB command line to debug a program? If so, what was
> the GDB command line you used?
Yes, as stated in my script, I invoke Emacs's "gdb" function
programatically supplying it with a command line that is essentially
"c:/msys64/ucrt64/bin/gdb.exe -i=mi /path/to/my.exe" I have also tried
invoking it interactively with similar success. The script I provided is
a bit more clear in the choice of system and paths.
> What program are you debugging? Is it a native MS-Windows
> (a.k.a. "MinGW") program, or is it an MSYS2 program that depends on
> the MSYS DLL? Also, is it a console program or something else, like a
> program using curses or some other unusual methods of writing to the
> screen?
I am debugging applications built using cmake + g++ natively (MinGW with
either ucrt64 or older runtimes). They are all console
applications. Launching the debugger from a terminal works for the same
application, but, of course, I lose integration with Emacs.
> What happens if you manually add "C:/msys64/ucrt64/bin" to PATH
> outside of Emacs, and then invoke GDB from the Windows Command Prompt
> window to debug that same program -- does that work as expected?
I prefer not to add MSYS2 + Mingw/Ucrt64 to the path because it collides
with various tools and because I want to be able to use different
toolchains, which does not work if I set the path to point to those
environments (this is what project-cmake automates)
This said, another way to reproduce this issue is to open a
Mingw64/Ucrt64 native console, launch emacs from that console and invoke
M-x gdb. The debugger still stops after launching the initial threads,
hiding the remaining console output, as shown below. I verified that the
problem exists with both ucrt64 and mingw64 runtimes.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from c:/home/juanjo/src/tensor/build-msys2-ucrt64/tests/test_rand.exe...
(gdb) run
Starting program: c:\home\juanjo\src\tensor\build-msys2-ucrt64\tests\test_rand.exe
[New Thread 9944.0x1a28]
[New Thread 9944.0x28c0]
[New Thread 9944.0x3a00]
<--- Here it stops. If I press <enter> it shows the console output.
--
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es
next prev parent reply other threads:[~2022-03-14 17:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 11:18 gdb fails to flush output (msys2) Juan José García-Ripoll
2022-03-14 13:33 ` Eli Zaretskii
2022-03-14 17:55 ` Juan José García-Ripoll [this message]
2022-03-14 18:23 ` Eli Zaretskii
2022-03-14 18:40 ` Eli Zaretskii
2022-03-15 9:58 ` Juan José García-Ripoll
2022-03-15 11:48 ` Jostein Kjønigsen
2022-03-15 13:24 ` Juan José García-Ripoll
2022-03-15 13:33 ` Juan José García-Ripoll
2022-03-15 14:34 ` Eli Zaretskii
2022-03-15 14:40 ` Juan José García-Ripoll
2022-03-15 16:47 ` Eli Zaretskii
2022-03-15 17:38 ` Juan José García-Ripoll
2022-03-15 17:56 ` Eli Zaretskii
2022-03-15 15:12 ` Juan José García-Ripoll
2022-03-15 16:53 ` Eli Zaretskii
2022-03-15 14:25 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=867d8wa05w.fsf@csic.es \
--to=juanjose.garciaripoll@gmail.com \
--cc=emacs-devel@gnu.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).