Bug 18095 - Break at every line in a specific function
Summary: Break at every line in a specific function
Status: WAITING
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: 7.7
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-09 06:08 UTC by Rohit
Modified: 2015-03-09 09:26 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rohit 2015-03-09 06:08:34 UTC
Say, I want to keep stepping only in the source code that I build that has multiple functions, but going from one function to another is through standard template library.

In that case, I don't want to step inside the STL source code and directly jump to the call which executes from the middle of another function I created. One option is to set breakpoints inside every function where I want to go, but that is very cumbersome. Another option is to use next instead to step, but that will again jump directly to next line in the same original function.

So, if there was some construct which facilitates breaking in only the source file I mention, or which possibly adds the breakpoints at every line in the specified functions, then I would be able to parse from one function to another through standard template library without going into standard template library.

This is used extensively in SystemC which is a set of C++ libraries for modelling hardware and execution address goes from one class to another in the middle of function through Kernel which is implemented in standard template library.
Comment 1 Pedro Alves 2015-03-09 09:02:06 UTC
Did you try the "skip" command?
Comment 2 Rohit 2015-03-09 09:26:53 UTC
(In reply to Pedro Alves from comment #1)
> Did you try the "skip" command?

Yes, I did and infact what skip does is that it skips everything inside that function and it also skips all the other functions which are called inside the function to be skipped.

Example.

main.cpp
F1(F2());

and F2 is defined in STL (some header file)
stl.cpp
F2() {
 F3()
}
main2.cpp
and F3() invokes my user defined source code F4()
F4 () {

}

Since F2 and F3 are implemented in STL, I would only want to debug F1 and F4 and the way it is visible to designer is that from F1, it will jump to F4.

It is not necessary that function may be invoked from the starting, as there are wait() inside the threads which keep them halted for a fixed time and are executed once simulation time is achieved.

Now, if we try skip command on F2(), while debugging I will directly come to next line of main.cpp, but internally it might have executed F4 and I want to go step by step in that code as well because I designed that.

I tried setting breakpoints at functions as well, but that only gives me breakpoint at the start of the function and in this case, the function may be halted in between and resumed someime after. So, this will work if function is called first time, but won't work in most of the cases when function will resume from between.

All I ask is that there should be some command in gdb to step only in the source code file specified by user and not go step by step in STL library functions.