* specifying gdb's exit code
@ 2014-04-17 18:48 Daniel Gutson
2014-04-17 19:08 ` Paul_Koning
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Daniel Gutson @ 2014-04-17 18:48 UTC (permalink / raw)
To: gdb
Hi,
Due to a specific need, I was thinking of a way to specify (e.g.
from a script) the gdb exit status,
specially in terms of the $_exitcode.
AFAIK, this is not currently possible since gdb returns only about the
finalization execution status
of the inf. I understand that these could be messed, specially when in
--batch mode, but it should be
responsibility of the developer to specify an exit code different to
those gdb may return, and also
responsibility of the invoking program to make such distinction.
The options I can think about are:
- set a convenience var, such as $_gdbexitcode
- set gdb-exit-code [n]
- add an optional argument to the 'quit' command (so "quit
$_exitcode" is available)
Ideas?
Thanks!
Daniel.
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 18:48 specifying gdb's exit code Daniel Gutson
@ 2014-04-17 19:08 ` Paul_Koning
2014-04-17 19:58 ` Daniel Gutson
2014-04-22 12:59 ` Andrew Stubbs
2 siblings, 0 replies; 9+ messages in thread
From: Paul_Koning @ 2014-04-17 19:08 UTC (permalink / raw)
To: daniel.gutson; +Cc: gdb
You can do this using Python scripting:
(gdb) python import sys; sys.exit(123)
paul
On Apr 17, 2014, at 2:43 PM, Daniel Gutson <daniel.gutson@tallertechnologies.com> wrote:
> Hi,
>
> Due to a specific need, I was thinking of a way to specify (e.g.
> from a script) the gdb exit status,
> specially in terms of the $_exitcode.
>
> AFAIK, this is not currently possible since gdb returns only about the
> finalization execution status
> of the inf. I understand that these could be messed, specially when in
> --batch mode, but it should be
> responsibility of the developer to specify an exit code different to
> those gdb may return, and also
> responsibility of the invoking program to make such distinction.
>
> The options I can think about are:
> - set a convenience var, such as $_gdbexitcode
> - set gdb-exit-code [n]
> - add an optional argument to the 'quit' command (so "quit
> $_exitcode" is available)
>
> Ideas?
>
> Thanks!
>
> Daniel.
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
> Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 18:48 specifying gdb's exit code Daniel Gutson
2014-04-17 19:08 ` Paul_Koning
@ 2014-04-17 19:58 ` Daniel Gutson
2014-04-17 21:35 ` Doug Evans
2014-04-22 12:59 ` Andrew Stubbs
2 siblings, 1 reply; 9+ messages in thread
From: Daniel Gutson @ 2014-04-17 19:58 UTC (permalink / raw)
To: gdb
Sorry. Please ignore this email.
I just noticed that "quit" already accepts an argument.
On Thu, Apr 17, 2014 at 3:43 PM, Daniel Gutson
<daniel.gutson@tallertechnologies.com> wrote:
> Hi,
>
> Due to a specific need, I was thinking of a way to specify (e.g.
> from a script) the gdb exit status,
> specially in terms of the $_exitcode.
>
> AFAIK, this is not currently possible since gdb returns only about the
> finalization execution status
> of the inf. I understand that these could be messed, specially when in
> --batch mode, but it should be
> responsibility of the developer to specify an exit code different to
> those gdb may return, and also
> responsibility of the invoking program to make such distinction.
>
> The options I can think about are:
> - set a convenience var, such as $_gdbexitcode
> - set gdb-exit-code [n]
> - add an optional argument to the 'quit' command (so "quit
> $_exitcode" is available)
>
> Ideas?
>
> Thanks!
>
> Daniel.
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
> Skype: dgutson
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 19:58 ` Daniel Gutson
@ 2014-04-17 21:35 ` Doug Evans
2014-04-17 21:52 ` Daniel Gutson
0 siblings, 1 reply; 9+ messages in thread
From: Doug Evans @ 2014-04-17 21:35 UTC (permalink / raw)
To: Daniel Gutson; +Cc: gdb
On Thu, Apr 17, 2014 at 12:08 PM, Daniel Gutson
<daniel.gutson@tallertechnologies.com> wrote:
> Sorry. Please ignore this email.
>
> I just noticed that "quit" already accepts an argument.
Heh.
IWBN if "help quit" pointed this out though.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 21:35 ` Doug Evans
@ 2014-04-17 21:52 ` Daniel Gutson
2014-04-18 8:20 ` Daniel Gutson
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gutson @ 2014-04-17 21:52 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb
On Thu, Apr 17, 2014 at 6:32 PM, Doug Evans <dje@google.com> wrote:
> On Thu, Apr 17, 2014 at 12:08 PM, Daniel Gutson
> <daniel.gutson@tallertechnologies.com> wrote:
>> Sorry. Please ignore this email.
>>
>> I just noticed that "quit" already accepts an argument.
>
> Heh.
> IWBN if "help quit" pointed this out though.
I thought the same, since that was the first thing I did (help quit
and apropos exit),
it would have helped.
I'll fix the help and send the patch.
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 21:52 ` Daniel Gutson
@ 2014-04-18 8:20 ` Daniel Gutson
2014-04-22 12:55 ` Daniel Gutson
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gutson @ 2014-04-18 8:20 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]
What about this?
(I'm not a native English speaker)
If OK, please commit it for me since I don't have write-access.
Thanks!
Daniel.
2014-04-17 Daniel Gutson <daniel.gutson@tallertechnologies.com>
gdb/cli/
* cli-cmds.c (_initialize_cli_cmds): Improve help message for
the quit command.
On Thu, Apr 17, 2014 at 6:34 PM, Daniel Gutson
<daniel.gutson@tallertechnologies.com> wrote:
> On Thu, Apr 17, 2014 at 6:32 PM, Doug Evans <dje@google.com> wrote:
>> On Thu, Apr 17, 2014 at 12:08 PM, Daniel Gutson
>> <daniel.gutson@tallertechnologies.com> wrote:
>>> Sorry. Please ignore this email.
>>>
>>> I just noticed that "quit" already accepts an argument.
>>
>> Heh.
>> IWBN if "help quit" pointed this out though.
>
> I thought the same, since that was the first thing I did (help quit
> and apropos exit),
> it would have helped.
> I'll fix the help and send the patch.
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
> Skype: dgutson
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
[-- Attachment #2: quit_help.patch --]
[-- Type: text/x-patch, Size: 636 bytes --]
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index bfcd975..40967bf 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1685,7 +1685,9 @@ strict == evaluate script according to filename extension, error if not supporte
show_script_ext_mode,
&setlist, &showlist);
- add_com ("quit", class_support, quit_command, _("Exit gdb."));
+ add_com ("quit", class_support, quit_command, _("\
+Exit gdb.\n\
+Can optionally be followed by the exit code that gdb should return."));
c = add_com ("help", class_support, help_command,
_("Print list of commands."));
set_cmd_completer (c, command_completer);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-18 8:20 ` Daniel Gutson
@ 2014-04-22 12:55 ` Daniel Gutson
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Gutson @ 2014-04-22 12:55 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb, gdb-patches
ping for micro and trivial patch.
(though I'm not sure if I should re-generate the .po files?)
On Thu, Apr 17, 2014 at 6:51 PM, Daniel Gutson
<daniel.gutson@tallertechnologies.com> wrote:
> What about this?
> (I'm not a native English speaker)
>
> If OK, please commit it for me since I don't have write-access.
>
> Thanks!
>
> Daniel.
>
> 2014-04-17 Daniel Gutson <daniel.gutson@tallertechnologies.com>
>
> gdb/cli/
> * cli-cmds.c (_initialize_cli_cmds): Improve help message for
> the quit command.
>
> On Thu, Apr 17, 2014 at 6:34 PM, Daniel Gutson
> <daniel.gutson@tallertechnologies.com> wrote:
>> On Thu, Apr 17, 2014 at 6:32 PM, Doug Evans <dje@google.com> wrote:
>>> On Thu, Apr 17, 2014 at 12:08 PM, Daniel Gutson
>>> <daniel.gutson@tallertechnologies.com> wrote:
>>>> Sorry. Please ignore this email.
>>>>
>>>> I just noticed that "quit" already accepts an argument.
>>>
>>> Heh.
>>> IWBN if "help quit" pointed this out though.
>>
>> I thought the same, since that was the first thing I did (help quit
>> and apropos exit),
>> it would have helped.
>> I'll fix the help and send the patch.
>>
>> --
>>
>> Daniel F. Gutson
>> Chief Engineering Officer, SPD
>>
>>
>> San Lorenzo 47, 3rd Floor, Office 5
>>
>> Córdoba, Argentina
>>
>>
>> Phone: +54 351 4217888 / +54 351 4218211
>>
>> Skype: dgutson
>
>
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
> Skype: dgutson
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-17 18:48 specifying gdb's exit code Daniel Gutson
2014-04-17 19:08 ` Paul_Koning
2014-04-17 19:58 ` Daniel Gutson
@ 2014-04-22 12:59 ` Andrew Stubbs
2014-04-22 13:06 ` Daniel Gutson
2 siblings, 1 reply; 9+ messages in thread
From: Andrew Stubbs @ 2014-04-22 12:59 UTC (permalink / raw)
To: Daniel Gutson, gdb
On 17/04/14 19:43, Daniel Gutson wrote:
> Due to a specific need, I was thinking of a way to specify (e.g.
> from a script) the gdb exit status,
> specially in terms of the $_exitcode.
Does --return-child-result not do what you need?
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: specifying gdb's exit code
2014-04-22 12:59 ` Andrew Stubbs
@ 2014-04-22 13:06 ` Daniel Gutson
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Gutson @ 2014-04-22 13:06 UTC (permalink / raw)
To: Andrew Stubbs; +Cc: gdb
On Tue, Apr 22, 2014 at 9:55 AM, Andrew Stubbs <ams@codesourcery.com> wrote:
> On 17/04/14 19:43, Daniel Gutson wrote:
>>
>> Due to a specific need, I was thinking of a way to specify (e.g.
>> from a script) the gdb exit status,
>> specially in terms of the $_exitcode.
>
>
> Does --return-child-result not do what you need?
Hi Andrew,
it's already solved :) (not exactly, quit [n] does)
The patch is just about documenting 'quit' properly.
>
> Andrew
--
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: dgutson
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-04-22 12:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 18:48 specifying gdb's exit code Daniel Gutson
2014-04-17 19:08 ` Paul_Koning
2014-04-17 19:58 ` Daniel Gutson
2014-04-17 21:35 ` Doug Evans
2014-04-17 21:52 ` Daniel Gutson
2014-04-18 8:20 ` Daniel Gutson
2014-04-22 12:55 ` Daniel Gutson
2014-04-22 12:59 ` Andrew Stubbs
2014-04-22 13:06 ` Daniel Gutson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox