clayborg wrote:

> For the first half, maybe you would avoid crashes by keeping everything 
> around, but you could end up having a global variable that got its type from 
> one Module and then you replace the module with another and get a local 
> variable out of them and now you have some stale types and some new ones... 
> That just seems like leading towards confusion even if not crashes.

we want to replace placeholders with real modules. There will be no global 
variables or other things around for these. And if the module is kept around, 
nothing will crash.

Not sure what stale types you are talking about here. That happens with modules 
being replaced when you re-launch your target every day. We don't have crashes 
related to those. This is not much different than restarting a debug session 
with a freshly built binary. 

> It sounds to me like you are trying to model lazy module creation, so it 
> seems like it would be better to do that explicitly rather than have the user 
> have to juggle this and hope they didn't cause any confusions.

We aren't. We are just trying to deal with millions of core files that we have 
everyday and we don't always have symbols as they live for a small amount of 
time before they get removed from our symbol server. Sometimes people still 
have symbols in their personal directories and they send us the symbol file for 
a bug report. Either way, it is useful for us to be able to replace a 
placeholder with a valid file.

> You could for instance make a placeholder Module class that can answer the 
> sort of questions the ModuleSpec provides answers to. If you ask it any 
> questions that might require more information, the Placeholder Module could 
> use the ModuleLocator to realize the actual module, and hold that as a 
> private module in the Placeholder and forward all questions it couldn't 
> answer to the privately held module. Everything you got from the Module would 
> be from one source, and so would stay consistent. If another Target came 
> along and asked for the same UUID it wouldn't be a crap-shoot what it got. It 
> would get the placeholder Module from the global module cache and everything 
> would stay orderly.

So your idea is to have the placeholder module, every time it needs something 
that it can't supply, call the ModuleLocator over and over until it finally 
says yes, instead of a user being able to just replace the module if the user 
knows they want to?

We can keep this as an internal patch if no one wants this, but it seemed like 
a good thing to upstream as it has been useful for us.



https://github.com/llvm/llvm-project/pull/214576
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to