* [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script
@ 2016-01-25 19:26 Christian Schwarzgruber
2016-01-25 20:14 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Christian Schwarzgruber @ 2016-01-25 19:26 UTC (permalink / raw
To: emacs-devel
Hello everybody,
I have question about `gdb(-mi)' in emacs 24.5. I have written a bash debug
wrapper script do choose between various front-ends and do some other stuff.
When I do; M-x gdb RET; delete the default value; enter the script name along
with the other optional parameters, and hit enter. Everything gets initialized
successfully. Debugging the program works as well.
Example:
Run gdb (like this) dscript --cd=/path/to/the/executable executable ...
However, the output of the debugee gets not redirected to the *input/output of
...* buffer. Does someone know what the cause could be. Or how to further triage
this problem/(bug?).
NOTE:
(gdb) show inferior-tty
shows the correct tty value, i.e. the tty of the *input/output of ...* buffer.
Thank you for your help!
--
Christian Schwarzgruber
E: c.schwarzgruber.cs@gmail.com
GPG key ID: C57AB673
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script
2016-01-25 19:26 [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script Christian Schwarzgruber
@ 2016-01-25 20:14 ` Eli Zaretskii
2016-01-25 21:16 ` Christian Schwarzgruber
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2016-01-25 20:14 UTC (permalink / raw
To: Christian Schwarzgruber; +Cc: emacs-devel
> From: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
> Date: Mon, 25 Jan 2016 20:26:31 +0100
>
> I have question about `gdb(-mi)' in emacs 24.5. I have written a bash debug
> wrapper script do choose between various front-ends and do some other stuff.
> When I do; M-x gdb RET; delete the default value; enter the script name along
> with the other optional parameters, and hit enter. Everything gets initialized
> successfully. Debugging the program works as well.
>
> Example:
> Run gdb (like this) dscript --cd=/path/to/the/executable executable ...
>
> However, the output of the debugee gets not redirected to the *input/output of
> ...* buffer. Does someone know what the cause could be. Or how to further triage
> this problem/(bug?).
>
> NOTE:
> (gdb) show inferior-tty
> shows the correct tty value, i.e. the tty of the *input/output of ...* buffer.
You didn't say what does your dscript do to run GDB. It's hard to
answer your questions without knowing that. For starters, does it
invoke GDB with the -i=mi command-line switch? If not, that's your
first problem.
Also, if you invoke GDB directly like the default prompt suggests,
does the problem go away?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script
2016-01-25 20:14 ` Eli Zaretskii
@ 2016-01-25 21:16 ` Christian Schwarzgruber
2016-01-26 15:44 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Christian Schwarzgruber @ 2016-01-25 21:16 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel
Sorry! Here are more details.
- The script creates a temporary GDB init-script, to set some GDB options etc.
``` Content of the script (lets call it gdb-init-script).
alias il = info locals
alias ia = info args
define hook-quit
clear main
save breakpoints gdb-breakpoints
end
set confirm off
set verbose off
set history filename ~/.gdb_history
set history save
set print array on
set print array-indexes on
set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set demangle-style gnu-v3
set print sevenbit-strings off
source gdb-breakpoints
break main
run
```
It does contain more stuff, but only when the script is invoked from the shell
or when remote debugging, but isn't relevant in this case.
Tries:
1) Invoking GDB via the debug script.
gdb -i=mi -x /tmp/gdb-init-script --args executable prog-arguments
2) Invoking GDB directly does work
gdb -i=mi --args executable prog-arguments
Now, as I wrote this. I tried to not pass the gdb-init-script to GDB (1), and
the output of the program gets redirected correctly to the *input/output*
buffer. I further commented out one line at a time from the gdb-init-script.
Which revealed, that the `run` command at the end of the gdb-init-script is
causing this issue. I should have tried this earlier :-/.
Anyway, I think this happens probably because the initialization of the GDB
interface in Emacs is not done at the moment the `run` command gets
executed. Just a suspicion but I'm not sure.
Thank you!
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
>> Date: Mon, 25 Jan 2016 20:26:31 +0100
>>
>> I have question about `gdb(-mi)' in emacs 24.5. I have written a bash debug
>> wrapper script do choose between various front-ends and do some other stuff.
>> When I do; M-x gdb RET; delete the default value; enter the script name along
>> with the other optional parameters, and hit enter. Everything gets initialized
>> successfully. Debugging the program works as well.
>>
>> Example:
>> Run gdb (like this) dscript --cd=/path/to/the/executable executable ...
>>
>> However, the output of the debugee gets not redirected to the *input/output of
>> ...* buffer. Does someone know what the cause could be. Or how to further triage
>> this problem/(bug?).
>>
>> NOTE:
>> (gdb) show inferior-tty
>> shows the correct tty value, i.e. the tty of the *input/output of ...* buffer.
>
> You didn't say what does your dscript do to run GDB. It's hard to
> answer your questions without knowing that. For starters, does it
> invoke GDB with the -i=mi command-line switch? If not, that's your
> first problem.
>
> Also, if you invoke GDB directly like the default prompt suggests,
> does the problem go away?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script
2016-01-25 21:16 ` Christian Schwarzgruber
@ 2016-01-26 15:44 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2016-01-26 15:44 UTC (permalink / raw
To: Christian Schwarzgruber; +Cc: emacs-devel
> From: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 25 Jan 2016 22:16:21 +0100
>
> Now, as I wrote this. I tried to not pass the gdb-init-script to GDB (1), and
> the output of the program gets redirected correctly to the *input/output*
> buffer. I further commented out one line at a time from the gdb-init-script.
> Which revealed, that the `run` command at the end of the gdb-init-script is
> causing this issue. I should have tried this earlier :-/.
>
> Anyway, I think this happens probably because the initialization of the GDB
> interface in Emacs is not done at the moment the `run` command gets
> executed. Just a suspicion but I'm not sure.
Yes, I think gdb-mi wants to see the result of the "run" command to
set up I/O redirection.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-26 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 19:26 [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script Christian Schwarzgruber
2016-01-25 20:14 ` Eli Zaretskii
2016-01-25 21:16 ` Christian Schwarzgruber
2016-01-26 15:44 ` Eli Zaretskii
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.