Saturday, 15 January 2011

c - How to debug "Abort trap: 6" error with gdb -



c - How to debug "Abort trap: 6" error with gdb -

i have c programme compile in 1 of 2 ways: "regular" , "debug".

when run "regular" build, abort trap: 6 error message, need fix.

when run "debug" version within gdb, not error message , programme runs completion.

the compilation options , flags "regular" build are:

bldflags = -wall -wextra -pedantic -std=c99 cflags = -d__stdc_constant_macros -d_file_offset_bits=64 -d_largefile64_source=1 -o3

the compilation flags "debug" build are:

bldflags = -wall -wextra -pedantic -std=c99 cdflags = -d__stdc_constant_macros -d_file_offset_bits=64 -d_largefile64_source=1 -ddebug=1 -g -o0 -fno-inline

the "regular" , "debug" targets compiled so:

regular: setup $(cc) $(bldflags) $(cflags) -c $(source) -o $(objdir)/$(prog).o $(includes) $(cc) $(bldflags) $(cflags) $(objdir)/$(prog).o -o $(prog) -lpthread debug: setup $(cc) $(bldflags) $(cdflags) -c $(source) -o $(objdir)/$(prog).o $(includes) $(cc) $(bldflags) $(cdflags) $(objdir)/$(prog).o -o $(prog) -lpthread

basically, these targets identically processed, exception of cflags , cdflags variables.

i post hundreds of lines of c code, debug code virtually identical regular code, exception of more verbose comments sent stderr.

is there component of cdflags (the "debug" build flags) preventing gdb beingness able stop processing on sigabrt (abort trap: 6)?

is there component of cdflags (the "debug" build flags) preventing gdb beingness able stop processing on sigabrt

you appear misunderstand what's happening.

it's not gdb not stopping on sigabrt. it's application, when compiled without optimization, not phone call abort in first place!

it not @ uncommon application bugs show in optimized builds.

on platforms, can add together -g "regular" build, run resulting binary under gdb, , when gdb stops on sigabrt, examine phone call stack gdb where command.

you can without -g. should still stack trace, file/line info missing it.

c debugging gdb sigabrt trap

No comments:

Post a Comment