This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ver_test_8_2.so


David Miller <davem@davemloft.net> writes:

> BTW, this might be a stupid question, but I have a devil of a time setting
> breakpoints on the templated functions in sparc.cc, and I wonder if it's
> because the code in that file gets put into an anonymous namespace?
>
> For example, if I wanted to set a breakpoint on:
>
> 	Target_sparc<32, true>::Scan::local()
>
> how might I specify that to gdb?

The trick I use is extensive use of tab completion.  Using that, I
wind up with this:

break '(anonymous namespace)::Target_sparc<32, true>::Scan::local(gold::General_options const&, gold::Symbol_table*, gold::Layout*, (anonymous namespace)::Target_sparc<32, true>*, gold::Sized_relobj<32, true>*, unsigned int, gold::Output_section*, elfcpp::Rela<32, true> const&, unsigned int, elfcpp::Sym<32, true> const&)'

I typed

break '(<tab> n<tab>::Ta<tab>sp<tab>32, true<tab>Scan::local<tab>'

The hardest parts are: 1) you have to remember the space after the
comma in "32, true", as omitting the space seems refers to the class
generically rather than a method in the class; 2) some template
functions include the return type in the mangled name, and then you
have to type the return type first.


Another approach is to use rbreak.  But it's kind of tricky since it
doesn't seem to match across the class name for some reason, and just
matching the function names finds too many matches.  But "rbreak
^local$" will set a reasonable number of breakpoints including the one
you want.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]