I got a segment error in an object like this:
http_client_reset(struct http_client *client) { if (client->last_req) { ... } }
When debugging a core dump file in GDB, the client memory address is 0x40a651c0 . I tried several times and the address is the same.
Then I tried the bt command in GDB:
(gdb) bt #0 0x0804c80e in http_client_reset ( c=<error reading variable: Cannot access memory at address 0x40a651c0>, c@entry =<error reading variable: Cannot access memory at address 0x40a651bc>) at http/client.c:170 Cannot access memory at address 0x40a651bc
there is no traceback message, I have grep ed my source code, and there is only one http_client_reset call.
- How to debug such an error through only the memory address ?
- Is there any way to judge that an object is valid before accessing its field (except
obj == NULL )?
source share