[Lldb-commits] [PATCH] D128694: [lldb/Dataformatters] Adapt C++ std::string dataformatter for D128285

Louis Dionne via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 28 08:02:42 PDT 2022


ldionne added inline comments.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:637
     if (location_sp->GetName() == g_size_name)
-      location_sp = short_sp->GetChildAtIndex(3, true);
+      location_sp = short_sp->GetChildAtIndex(2, true);
     if (using_bitmasks)
----------------
mib wrote:
> mib wrote:
> > aprantl wrote:
> > > Let me know if I',m misunderstanding what the code is doing, but this looks like it is replacing the previous implementation? Ideally we would detect the layout and then parse it correctly depending on which version we're dealing with. Otherwise we risk breaking the matrix bot that checks that LLDB can debug C++ produced by older versions of LLVM (and by extension libcxx).
> > I've look at D12828 and D123580, and I don't see any way of versioning these changes ... may be @ldionne have an idea on how we could do this properly ?
> > 
> > Also, in D124113, @labath mentions that this data formatter uses mostly indices to parse and access the various fields of the type data structure (because it uses some anonymous structs). This makes it very fragile on our end because our data formatter break every time they make a change in the layout ...
> > 
> > @aprantl, I'll update the line your pointed at to the the field identifier instead of using changing the index while waiting for a better way to version this.
> @aprantl, I'll update the line you pointed at to *use* the field identifier instead of using changing the index, while waiting for a better way to version this.
I don't see a way to version this. You don't have access to the value of macros that were defined when the executable was compiled, right? If you did, you could check `_LIBCPP_VERSION` (1400 = old implementation, 1500 = current implementation). I'm very naive when it comes to debuggers but I assume that's not possible.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128694/new/

https://reviews.llvm.org/D128694



More information about the lldb-commits mailing list