[Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 26 15:16:28 PST 2016


> On Feb 26, 2016, at 2:49 PM, Zachary Turner <zturner at google.com> wrote:
> 
> 
> 
> On Thu, Feb 18, 2016 at 6:16 PM Greg Clayton <clayborg at gmail.com> wrote:
> 
> > Just to make sure I understand, is it safe to say that:
> >
> > If check_inlines is false, sc_list should return with exactly 1 SymbolContext with m_comp_unit set to the main source file?
> 
> You would get one SymbolContext per compile unit whose path matches the file_spec _and_ contains a line number. There might be multiple "Foo.cpp" files in different directories withing one PDB file, so you might still end up finding N matches. So your existing code can be used when check_inlines if false as long as the PDB can search by fullname and by basename. I am guessing it doesn't though, am I wrong?
> 
> > The same for the check_inlines is false calse -- we still just have  SymbolContext but we add line table entries from all additional files that contribute to the compilation unit?
> > When will sc_list end up with multiple entries?
> 
> You always look through all compile units. If check_inlines is false, then you make sure "file_spec" matches (by basename  if only basename is specified, or by full path if a directory and filename are valid inside file_spec. If the file matches, then look for any lines that match and return ALL instances of them. Auto inlining of a function inside a compile unit might cause there to be many entries for line 10.
> 
> I'm coming back around to this now.  What happens if check_inlines is False, but the FileSpec is a header file like <vector>.  You said "If check_inlines is false, make sure file_spec matches".  But if file_spec is a header file, it's never going to match anything.  Should I simply expect that the API is not called in this way?  

It can be called, but you should only match on compile units whose files match "vector" as the basename.

> i.e. if I write b vector:1234 then I can expect that check_inlines will be true?

By default check_inlines is always true, but the user can change this setting:

(lldb) settings set target.inline-breakpoint-strategy 
Available completions:
	never
	always
	headers

The default is aways:

(lldb) settings show target.inline-breakpoint-strategy 
target.inline-breakpoint-strategy (enum) = always

"headers" will try to determine if the source file name is actually a header and enable check_inlines only if it thinks it is a header. Or I should say it will enable check_inlines if it things the file is _not_ a source file. So anything with no extension will always be a header.

So you can expect that check_inlines will be true. If someone writes code that is C and C++ only where they never inline anything, they can get a performance boost from setting the setting to "headers" or "never" as we won't be going through all lines tables looking for "foo.cpp" looking for inline instances. 

Greg




More information about the lldb-commits mailing list