emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gdb(-mi)] Output of debugee not redirected to *input/output of ...*


From: Christian Schwarzgruber
Subject: Re: [gdb(-mi)] Output of debugee not redirected to *input/output of ...* buffer when starting gdb via a script
Date: Mon, 25 Jan 2016 22:16:21 +0100
User-agent: mu4e 0.9.16; emacs 24.5.1

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 <address@hidden> writes:

>> From: Christian Schwarzgruber <address@hidden>
>> 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]