[PATCH] D73961: [LLDB] Addresses can be two bytes in size
Ayke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 06:05:32 PST 2020
aykevl created this revision.
aykevl added reviewers: granata.enrico, labath, dylanmckay, Andrzej.
Herald added subscribers: llvm-commits, lldb-commits, hiraditya.
Herald added projects: LLDB, LLVM.
Addresses are usually two bytes in size on AVR, so make sure LLDB deals with that.
---
I'm not sure I caught all cases. In particular, lldb/include/lldb/DataFormatters/FormattersHelpers.h might be related but I've left it alone as it didn't seem to be necessary.
Honestly I think LLDB would become a lot more forgiving to uncommon architectures when these asserts are removed and avoids assumptions based on the address size. When the address size is relevant (for example, to read a value from memory), it should have an exhaustive test with a default case that does an assert (for easy debugging). For example:
switch (addr_size) {
case 4:
// do one thing
case 8:
// do something else
default:
assert(false && "unknown addr_size");
}
This way, it's easy to find the places that make these assumptions just by following the asserts.
I'm not sure how to add a test for this. I can test it locally by connecting to a remote debugger (simavr <https://github.com/buserror/simavr>). However, I don't know how to do something like that in the LLDB testing framework. Additionally, for that to work I only needed the change in DumpDataExtractor.cpp so I'm not sure how to exhaustively test this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73961
Files:
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Utility/DataExtractor.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73961.242306.patch
Type: text/x-patch
Size: 6040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/41017fd7/attachment-0001.bin>
More information about the llvm-commits
mailing list