11

I am teaching myself to use gdb and am running some random tests. It may be worth mentioning that I am using a portable installation of MinGW on Windows 7 x64. I've created a program which I know results in a stack overflow, and as I run through it in gdb I first get two SIGSEGV signals (no surprise), and then it exits (again no surprise) with code 030000000375.

Program received signal SIGSEGV, Segmentation fault.
Program received signal SIGSEGV, Segmentation fault.
Program exited with code 030000000375.

Curiosity getting the best of me... what the heck is that code? I googled it and found very little.

Thanks!

UPDATE: For reference I tried the same program on Ubuntu, and the results are slightly different:

Program received signal SIGSEGV, Segmentation fault.
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
1
  • Do you always get the same code? If so, have you tried changing the data of your program and seeing if you still get the same code? Commented Jul 8, 2012 at 21:49

1 Answer 1

11

gdb prints out the exit code in octal format. Not obvious, but indicated by the leading 0.

So 030000000375 is 0xC00000FD in hex, which makes the code look much more common to a windows programmer.

0xC00000FD is STATUS_STACK_OVERFLOW and should be defined in ntstatus.h.

Sign up to request clarification or add additional context in comments.

3 Comments

Good find, thanks! And very interesting that Windows actually tells you when you get a stack overflow, but linux does not.
You are welcome! Btw: Perhaps you should modify the topic of this question to "gdb: Program exited with code 030000000375" as it's not gdb exiting with this code. @The111
Done. And to answer your other question in the comments, the test program I was using is one I came up with long ago in this post where I inadvertently taught myself about the existence of stack overflows: stackoverflow.com/questions/8611198/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.