(gdb) s
Things:action (this=0x7fffffffdce0, packet=0x62c980) at file:41
41 if( thing->work(data) ) {
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
0x00000000004040e1 in Things:action (this=0x7fffffffdce0, packet=0x62c980) at file:41
41 if( thing->work(data) ) {
In a backtrace, call to work(data) is a last one; and the segmentation happened (as it seems) before the GDB-managed process entered work(data). In a list, there is no declaration of work(data), so guessing that more code was executed, than is shown by backtrace and latest step.
- Can that segfault come from the bad pointer being passed as a function argument in a bad manner (without “extern C”, or some other preparations)? (assuming no function code was executed)
- How to get a detailed trace to determine, was any
work()code executed after entering the function, or the error happened right at the moment, when process tried to enter the function, thereby passing it’s arguments to libc?
As I said in the comment : I believe that the execution never reached
work(data)because thethispointer is invalid (0x7fffffffdce0looks like garbage). The SIGSEGV is onthis->.Has the object been destroyed / deleted at some point, and have you kept a reference or pointer to it ?