Skip to content

lldb: remove hardcoded instruction encodings #55

Description

@JordiChauzi

In lldb, we are using hardcoded encodings in different places:

  • lldb/source/Host/common/NativeProcessProtocol.cpp: in NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode, g_dpu_opcode is the bkp encoding
  • lldb/scripts/dpu/dpu_commands.py: in dpu_attach_on_boot, we write the bkp encoding to memory
  • lldb/source/Plugins/Process/Dpu/Dpu.cpp:
    • in Dpu::Boot, breakpoint_instruction is the bkp encoding
    • in Dpu::GetThreadState, we check whether prev_instruction is the fault 1 encoding
  • lldb/source/Plugins/Process/Utility/RegisterContextDPU.cpp: in RegisterContextDPU::PCIsInstructionReturn we check whether instruction is the jump r23 encoding

This is mainly an issue when changing the ISA, which does not happen every week. However, when it happens, fixing some lldb issues may become harder than needed.

I think we should at least place all these encodings in a single place (per language), which will make it easier to change these values. Ideally we can imagine to generate these files from the metasm module.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions