1

Using gdb 7.12-6 - (on debian linux in a virtualbox) I have the problems described below using step

strangely using gdb 7.4.1-debian everything seems to be fine and there are no issues (debian linux in an older virtualbox on a different computer)

I am trying to step through code. I don't want to use next because I want to go into the subroutines I have written.

I am having a problem with it going into malloc.c, s_sin.c and a whole host of other library routines.

I have checked that step-mode is off

I have tried using skip /usr/include/*, skip /usr/include/*/*, skip /usr/include/*/*/*

I already looked at the questions below and didn't find the answer to my question

Preventing GDB from stepping into a function (or file)

gdb - skip further step in of certain file by predefined rule?

Any help would be much appreciated

[I am compiling with gcc -g -o program program.c -lm]

tom
  • 1,303
  • 10
  • 17
  • 2
    You can just use `fin` to get out of the current function. – hellow Aug 27 '18 at 13:56
  • @hellow thanks, that is useful, but not an ideal solution when, for example it seems to get confused by every `sin()` and `cos()` calculation – tom Aug 27 '18 at 13:57
  • 1
    Why are you stepping through anyway? You can use `break` to break on a function, a specific line in a file, a code adress, everything. – hellow Aug 27 '18 at 14:00
  • You also can use [`skip`](https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html) (okay, you know that. Why does that not work for you?!) – hellow Aug 27 '18 at 14:00
  • 2
    If it is stepping into libm functions then that machine probably has libm debuginfo installed. One simple fix would be to uninstall the debuginfo package; then the `step-mode` setting (TIL!) would take effect. Otherwise, you will need to refine your `step` commands -- look at the file name gdb reports for the offending functions. I'd expect them not to appear in `/usr/include` but somewhere else. – Tom Tromey Aug 27 '18 at 14:16
  • suggest learning about the `next` command, paying attention to what the next statement in the code is, and if you do not want to step into some function, then use `next` to have the debugger run right through it with out stopping – user3629249 Aug 28 '18 at 06:13
  • @hellow, thanks for the useful comments - I am just surprised that the behaviour of gdb is so different. I was using stepping to help track a bug. Was also using break points. The bug, of course, is now fixed, but I am still interesting in figuring out this issue with gdb... – tom Aug 28 '18 at 12:04
  • @TomTromey thanks for the useful comments. Bug is now resolved, but I am still interested to figure out what is going on with gdb. Will try to follow your suggestions... – tom Aug 28 '18 at 12:06
  • @user3629249, thanks for the suggestion. The bug I had is now resolved, but I take your point about using next to skip over... that would work for sin and cos functions, for example - thanks for making that point. – tom Aug 28 '18 at 12:08
  • May be you can get some informations using the testsuite http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/testsuite/README;h=152318a5070659c92587b7fe3ba66064f4a8cb0e;hb=refs/heads/gdb-7.12-branch – rantan pan Aug 28 '18 at 16:29

0 Answers0