all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <878u3dbbru.fsf@gmail.com> (raw)
In-Reply-To: <831t952z7l.fsf@gnu.org>

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?



  reply	other threads:[~2016-01-25 21:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-01-26 15:44     ` 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

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

  git send-email \
    --in-reply-to=878u3dbbru.fsf@gmail.com \
    --to=c.schwarzgruber.cs@gmail.com \
    --cc=eliz@gnu.org \
    --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 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.