[Lldb-commits] [PATCH] D48393: Make DWARFParsing more thread-safe

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 25 07:28:36 PDT 2018


clayborg added a comment.

In https://reviews.llvm.org/D48393#1244649, @labath wrote:

> I agree with Greg that it would be best to restrict things such that there is only one instance of parsing going on at any given time for a single module. I think this was pretty much the state we reached when this thread fizzled out the last time (there are some extra emails that are not showing in phabricator history, the interesting ones start around here: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180618/041937.html). I think the main part that needed to be resolved is whether we need to go anything special when resolving debug info references *between* modules (e.g. to prevent A/B deadlocks).


We don't have to worry about references between modules as no module loads _ANY_ debug info from another module. If a module only has a forward declaration to a type, we leave it as a forward declaration. Why do we do this? So we can cache modules in LLDB and use all the parsed state in the next debug session if we rerun. Lets say you have liba.so that has a type "struct Foo { int x; };" and libb.so has a "struct Foo; Foo *foo_ptr;". libb.so has debug info for "foo_ptr" that says it is a forward declaration. At expression evaluation time, we will end up digging up the correct definition for "struct Foo" from liba.so, but we must do that each time we evaluate an expression. If we change liba.so with "struct Foo { int x; int y; };" and re-run, we don't need to reload any debug info for libb.so (or keep track of any definitions we might have loaded from another file to know when liba.so changes that we need to invalidate any number of types in other shared libraries). So because of this, we don't run into the problem. The variable displaying infrastructure in ValueObject and the expression parser know how to locate types when they need to. This keeps everything clean in the debug info parsing code.


https://reviews.llvm.org/D48393





More information about the lldb-commits mailing list