From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian Schwarzgruber Newsgroups: gmane.emacs.devel 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 Message-ID: <878u3dbbru.fsf@gmail.com> References: <87bn89bguw.fsf@gmail.com> <831t952z7l.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1453763025 25435 80.91.229.3 (25 Jan 2016 23:03:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 23:03:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 26 00:03:41 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNqAe-0008Pe-Ct for ged-emacs-devel@m.gmane.org; Tue, 26 Jan 2016 00:03:40 +0100 Original-Received: from localhost ([::1]:41169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNqAa-00034Z-E5 for ged-emacs-devel@m.gmane.org; Mon, 25 Jan 2016 18:03:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNoUt-0007FF-28 for emacs-devel@gnu.org; Mon, 25 Jan 2016 16:16:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNoUp-0003Dr-Qd for emacs-devel@gnu.org; Mon, 25 Jan 2016 16:16:26 -0500 Original-Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:33980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNoUp-0003Dn-IE; Mon, 25 Jan 2016 16:16:23 -0500 Original-Received: by mail-wm0-x22d.google.com with SMTP id u188so82560108wmu.1; Mon, 25 Jan 2016 13:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type; bh=LwjWtYnoMNHhBF5h7I2jcqgCuKi9OZXsBTcqR2cxIZg=; b=F5GYXK4a57FdxJHV3sfHeWxEdH1Em89jryDRQ9I/TvkDG87408pKB7vbUiN22iVQvT hiR3eY0k3QbkvfRQSpRE56u42tjVPTc0Pa/r0uO4juY3E5uqwJPIpWwcxv1Fb2o/GBP/ 8RPoXzXjqeOWX4Y46I9G6QfOAr/23gXaO+ZyDCGhEAHlxLQxZojmMXcZqhFsv8fC9owh IINjWYTRgXorq5LFposm/jrTlMpZGg1CBr5xJkFttXk22yHIXX8xpEHp3PpLxraa2vHX K8LcqxNNiajBwYNtOmRGr2mwXalCt+GHpX0p00YAY0bZVc0bXmk/+goJvW4SoUHgo1TA riDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-type; bh=LwjWtYnoMNHhBF5h7I2jcqgCuKi9OZXsBTcqR2cxIZg=; b=DifLs90KL9i+EOgr09vbW+PrTbHBOWcXs8LldGkQK/Hz7HxQ0jh3tMNs+fPocjsjQ6 MAgyKbd2UqQSjeBj0dvSakGJibD4gEAeqBumd9qqTK5RDHuQa3WAnDAFRq8jEEo0n7mV Sj1+cFCyKbpw84maaXvihM3gTwt4SobrGQuAWPSXFGbrq5IOjwRRzmOICEK4sO2iOe/M 72PcOHVDq9gAKJ0iI1dI37feZqLn0MbH1aHFlyxLzoaYWzIthjB+0oXMVNSBzq2PIiq3 FxCCqNfNXbDrTTbNqvlOwNBQLwXjhP5buYUGwD2WfiZtZ05/WR0VQPVYwoz3LkBis5Kg gIxw== X-Gm-Message-State: AG10YOSGTmCTmBB7ue56dltR6Vw9qDE9Kbmt8EtElvlSdS+CJQiQD5B+P5FSa8c0zUp1zA== X-Received: by 10.28.103.215 with SMTP id b206mr22024095wmc.93.1453756582843; Mon, 25 Jan 2016 13:16:22 -0800 (PST) Original-Received: from lap (84-113-190-229.dynamic.surfer.at. [84.113.190.229]) by smtp.gmail.com with ESMTPSA id cv10sm20765533wjb.17.2016.01.25.13.16.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2016 13:16:22 -0800 (PST) User-agent: mu4e 0.9.16; emacs 24.5.1 In-reply-to: <831t952z7l.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22d X-Mailman-Approved-At: Mon, 25 Jan 2016 18:03:33 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198821 Archived-At: 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 writes: >> From: Christian Schwarzgruber >> 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?