Author Topic: Unexpected behavior of Step into option while debugging segfault  (Read 2374 times)

quastor

  • Guest
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.

Code
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?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Unexpected behavior of Step into option while debugging segfault
« Reply #1 on: July 22, 2022, 06:28:48 am »
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.