c++ - gdb, breakpoint in multiple locations -


i've set breakpoint in 1 of .h files has implementation of small method,

(gdb) break smallvector.h:141 

and here got gdb:

breakpoint 5 @ 0x416312: smallvector.h:141. (38 locations) 

why breakpoint set in 38 locations instead of single location?

i'm not new debugging c++ unfortunately i've never worked complex i'm working (compiler). i've never encountered before.

any appreciated.

there several ways can happen.

one main way, you've found, inline function. compilers (like gcc) emit debugging information inlining has done. gdb sees information , try set breakpoint @ every inlined location.

another typical way happen templates. each template instantiation have same location, break file:line result in breakpoint in every instantiation.

yet way happen if use break function , there multiple functions of same name. 1 scenario here confuses new users that, under hood, compiler emits multiple copies of constructor (look "in charge constructor" gory details).

one final way can happen if compiler other sorts of optimization, partial inlining. these more seen.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -