Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-09 Thread Pavel Labath via lldb-dev
On 05/02/2021 00:38, Jorge Gorbe Moya wrote: Wouldn't it be preferable to try_lock in GetDescription (which is the one currently acquiring the mutex) instead? I'd be uncomfortable with a function like GetDescription "randomly" doing nothing (returning an empty string, or whatever). OTOH, while

Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-08 Thread Greg Clayton via lldb-dev
A simpler solution is to remove the lock in Module::GetDescription(...) all of the data that is used to dump the module description is set correctly (the file, the arch and the object name for BSD archives)) very early on when a module is created before anyone should be making symbol or debug in

Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-05 Thread Jorge Gorbe Moya via lldb-dev
I just started looking at how to do this (having a separate mutex for the description) and I think I found another bug. Or maybe I'm missing some assumption. On one hand, Module::SetArchitecture won't assign the new value if m_arch is already valid, just return m_arch.IsCompatibleWith(new_arch). O

Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-04 Thread Raphael Isemann via lldb-dev
We could also just give the Module a std::string with the description and update it in the few places where we actually update it. The m_arch already has a setter in place that just needs to be used in a few more places, so the infrastructure is kind of already there (at least for m_arch). The desc

Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-04 Thread Jorge Gorbe Moya via lldb-dev
Wouldn't it be preferable to try_lock in GetDescription (which is the one currently acquiring the mutex) instead? ReportError doesn't touch any mutex itself and will happily report the rest of the error if GetDescription bails out. For the test case I sent it would look like this: error: {0x0

Re: [lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-04 Thread Pavel Labath via lldb-dev
Please have a look at , which is the last time this came up. One quick'n'dirty solution would be to have `Module::ReportError` _try_ to get the module lock, and if it fails, just bail out. That obviously means you won't get

[lldb-dev] Help fixing deadlock in DWARF symbol preloading

2021-02-04 Thread Jorge Gorbe Moya via lldb-dev
Hi, I've found a deadlock in lldb (see attached test case, you can build it with just `clang -o test test.s`), but I'm a total newbie and I have no idea what's the right way to fix it. The problem happens when an error is found during DIE extraction when preloading symbols. As far as I can tell,