[all-commits] [llvm/llvm-project] 208a08: Reland "[lldb] Parse and display register field en...

David Spickett via All-commits all-commits at lists.llvm.org
Mon Jul 1 02:46:17 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 208a08c3b7b00c05629c3f18811aac81f17cd81b
      https://github.com/llvm/llvm-project/commit/208a08c3b7b00c05629c3f18811aac81f17cd81b
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    M lldb/include/lldb/Target/RegisterFlags.h
    M lldb/source/Core/DumpRegisterInfo.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    M lldb/source/Plugins/RegisterTypeBuilder/RegisterTypeBuilderClang.cpp
    M lldb/source/Target/RegisterFlags.cpp
    M lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py
    M lldb/unittests/Core/DumpRegisterInfoTest.cpp

  Log Message:
  -----------
  Reland "[lldb] Parse and display register field enums" (#97258)" (#97270)

This reverts commit d9e659c538516036e40330b6a98160cbda4ff100.

I could not reproduce the Mac OS ASAN failure locally but I narrowed it
down to the test `test_many_fields_same_enum`. This test shares an enum
between x0, which is 64 bit, and cpsr, which is 32 bit.

My theory is that when it does `register read x0`, an enum type is
created where the undlerying enumerators are 64 bit, matching the
register size.

Then it does `register read cpsr` which used the cached enum type, but
this register is 32 bit. This caused lldb to try to read an 8 byte value
out of a 4 byte allocation:
READ of size 8 at 0x60200014b874 thread T0
<...>
=>0x60200014b800: fa fa fd fa fa fa fd fa fa fa fd fa fa fa[04]fa

To fix this I've added the register's size in bytes to the constructed
enum type's name. This means that x0 uses:
__lldb_register_fields_enum_some_enum_8
And cpsr uses:
__lldb_register_fields_enum_some_enum_4

If any other registers use this enum and are read, they will use the
cached type as long as their size matches, otherwise we make a new type.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list