I am trying to debug segfault and I have this output from gdb:
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x08048af9 in parse_option_list (ptr=0x6f72505f <Address 0x6f72505f out of bounds>, box_name=0x696d6978 <Address 0x696d6978 out of bounds>, option_list=0x313a7974,
num_elements=0x33313532) at submit.c:125
125 memcpy(&(option_list[(*num_elements)].value), value, 24);
(gdb) p num_elements
$15 = (int *) 0x33313532
(gdb) p *num_elements
Cannot access memory at address 0x33313532
(gdb)
It seems to me that something in memcpy () goes haywire. But I canβt understand what the problem is, since this line refers to so many variables.
Can someone help figure out what the string tells me 0x8048af9 in parse_option_list...?
My function signature:
int parse_option_list(char *ptr, char *box_name,
struct option_list_values *option_list, int *num_elements)
And this may be useful:
struct option_list_values {
char value[24];
char name[24];
};
In addition, variables valueand nameare not segfault (but if you think they are, I can post the code that sets these values.) But right now, if I can understand this conclusion the gdb, I'll be happy as a clam! Thanks!
source
share