How to debug a segmentation error

How to debug a segmentation error?

This is basically what happens:

I start my server in the background: ./server &

then I launched my client: ./client

When I try to log in to my server, the correct username and password are fine, but when I type the wrong password and password, this leads to a segmentation error.

How to make the compiler / debugger possible to output some kind of error that it actually sees, which causes a core dump of the segmentation kernel.

I know gdb, but I'm trying to use the gdb client, but it does not work.

+4
source share
3 answers

A good idea with segmentation errors is to run the program with valgrind for debugging. This way, you often get more detailed information about what caused your segmentation error. For example, it will tell you if you are reading from uninitialized memory.

+4
source

If you are using g ++, first compile your program using the -g option. Then use

  gdb name_of_program core 

to run gdb on a core dump that you get ( name_of_program is the name of the executable you just created with g ++). This link is useful for using gdb.

http://www.ibm.com/developerworks/library/l-gdb/

+4
source

These are annotations of code declarations. this is only useful if you have many function calls and you don’t know the call path.

-1
source

All Articles