News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Unexpected behavior of Step into option while debugging segfault

Started by quastor, July 21, 2022, 08:06:50 PM

Previous topic - Next topic

quastor

I'm trying to debug a segfault in my project the cause of which is in a known function and encountering an unexpected behavior of the debugger.
My main() function has one breakpoint at the first line and includes several calls to functions either from other .c files.
When I use the Step into option with a function located in another file, the IDE behaves as if I hit Next line and just executes the function at once.


int main(int argc, char **argv){
int n = argc;
while(--argc){
preproc(argv[n-argc]); /*just skips*/
proc(argv[n-argc]); /*just skips*/
write_code_to(argv[n-argc]); /*here is the segfault, also skips and just throws the segfault*/
}

return 0;
}


If it matters, I use a custom makefile with a single make command: $make -f $makefile
What are possible reasons and ways to fix?

ollydbg

Quote from: quastor on July 21, 2022, 08:06:50 PM
When I use the Step into option with a function located in another file, the IDE behaves as if I hit Next line and just executes the function at once.

Here are my suggestions:
1, can you show us the full debug log?
2, what happens if those two source files are inside a cbp file, I mean not using the custom makefile method.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.