[Lldb-commits] [PATCH] D78421: Fix out of sync source code/executable when debugging
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu May 28 09:15:46 PDT 2020
labath added a comment.
In D78421#2054544 <https://reviews.llvm.org/D78421#2054544>, @n1tram1 wrote:
> Passing a simple `Module &` sounds like an easy but I would also have to make `SourceManager::GetFile` take a `Module &`.
>
> There is one corner case, let's say file.c is being used by //Module A// and //Module B// (which are both shared libraries). If //file.c// is modified and //Module B// recompile and reloaded, well will want to see the updated //file.c// when stepping through //Module B// but we will want the old //file.c// when stepping through //Module B//.
> My issue is that the `SourceCacheManager` use only the `FileSpec` as a key to the cache, therefore it might fetch the wrong `File` (gets the //file.c// corresponding to //Module A// when we wanted the //file.c// corresponding to //Module B//).
> For the same reason I can't just modify `ModuleList::FindSourceFile` to have it return a `ModuleSP` because it might either //Module A// or //Module B//.
>
> I feel like there is a lot to be done for such a simple bug. I don't know it it's worth it...
I think a part of the problem is that it's not fully clear that this _is_ a bug. I mean, at a first glance, being able to display the actual source code if we have it is good. But this "best effort" aspect of it means it's hard for a user to know what exactly is the debugger doing. I mean, the fact that a file has an older timestamp than the module does not actually mean the module was built from that source file. The behavior "I display the file on disk, and in case it is newer than the module, I print a warning" is pretty simple to understand. However, if you change that to "I display the file on disk, and in case it is newer than the module, I print a warning, *unless* I happen to have a cached version of that file which is older than the module, in which case I print that" gets a lot fuzzier and may get people to think that the debugger is actually smart enough to find the "real" source file, which is of course not true.
So, I'm not actually convinced that this is an improvement...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78421/new/
https://reviews.llvm.org/D78421
More information about the lldb-commits
mailing list