public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb simulator exit status
@ 2008-01-17 12:42 M R Swami Reddy
  2008-01-17 14:32 ` Andrew STUBBS
  2008-01-17 14:40 ` Daniel Jacobowitz
  0 siblings, 2 replies; 4+ messages in thread
From: M R Swami Reddy @ 2008-01-17 12:42 UTC (permalink / raw)
  To: gdb

Hi,
I have C file as:
==
main () {
   return 1;
}
===

When I compile and run it, the status value is '1'
 > a.out
 > echo $status
 > 1

When I execute the same "a.out" on gdb simulator, the status shows as "0" (ie 
gdb's exit status) and gdb shows "Program exited with code 01".

Can you please suggest the way (if any) to get the gdb simulator's exit status 
with "echo $status" command"?

Thank in advance.

Thanks,
Swami

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb simulator exit status
  2008-01-17 12:42 gdb simulator exit status M R Swami Reddy
@ 2008-01-17 14:32 ` Andrew STUBBS
  2008-01-18  5:17   ` M R Swami Reddy
  2008-01-17 14:40 ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew STUBBS @ 2008-01-17 14:32 UTC (permalink / raw)
  To: M R Swami Reddy; +Cc: gdb

M R Swami Reddy wrote:
> Can you please suggest the way (if any) to get the gdb simulator's exit 
> status with "echo $status" command"?

Well, it works for me (target sh-elf), but maybe I'm using a more recent 
GDB or something.

Anyway, obviously it isn't working for you, so try this:

gdb --batch-silent \
	--return-child-result \
	-ex "target sim" \
	-ex load \
	-ex run \
	a.out

Hope that helps

Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb simulator exit status
  2008-01-17 12:42 gdb simulator exit status M R Swami Reddy
  2008-01-17 14:32 ` Andrew STUBBS
@ 2008-01-17 14:40 ` Daniel Jacobowitz
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2008-01-17 14:40 UTC (permalink / raw)
  To: M R Swami Reddy; +Cc: gdb

On Thu, Jan 17, 2008 at 06:11:37PM +0530, M R Swami Reddy wrote:
> Can you please suggest the way (if any) to get the gdb simulator's exit 
> status with "echo $status" command"?

It sounds like a bug in your particular simulator.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gdb simulator exit status
  2008-01-17 14:32 ` Andrew STUBBS
@ 2008-01-18  5:17   ` M R Swami Reddy
  0 siblings, 0 replies; 4+ messages in thread
From: M R Swami Reddy @ 2008-01-18  5:17 UTC (permalink / raw)
  To: Andrew STUBBS; +Cc: gdb


Andrew STUBBS wrote:
  > Well, it works for me (target sh-elf), but maybe I'm using a more recent
> GDB or something.
> 
> Anyway, obviously it isn't working for you, so try this:
> 
> gdb --batch-silent \
>     --return-child-result \
>     -ex "target sim" \
>     -ex load \
>     -ex run \
>     a.out

Thank you very much. The "--return-child-result" option works for me too.

Thanks,
Swami




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-18  5:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-17 12:42 gdb simulator exit status M R Swami Reddy
2008-01-17 14:32 ` Andrew STUBBS
2008-01-18  5:17   ` M R Swami Reddy
2008-01-17 14:40 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).