List Info

Thread: gdb simulator exit status




gdb simulator exit status
country flaguser name
United States
2008-01-17 06:41:37
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


Re: gdb simulator exit status
country flaguser name
France
2008-01-17 08:31:52
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

Re: gdb simulator exit status
country flaguser name
United States
2008-01-17 08:39:41
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

Re: gdb simulator exit status
country flaguser name
United States
2008-01-17 23:17:04
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





[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )