This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Add LoongArch software breakpoint trap opcode
ClosedPublic

Authored by seehearfeel on Nov 6 2022, 6:09 PM.

Details

Summary

Use break 0x5 for LoongArch software breakpoint traps.
The magic number 0x5 means BRK_SSTEPBP as defined in
the kernel header asm/break.h on LoongArch.

Diff Detail

Event Timeline

seehearfeel created this revision.Nov 6 2022, 6:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 6 2022, 6:09 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
seehearfeel requested review of this revision.Nov 6 2022, 6:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 6 2022, 6:09 PM
xen0n added a comment.Nov 6 2022, 6:16 PM

I think eventually the upstream Linux would gain support for hardware single-stepping, before the architecture is widely adopted (to be frank, if at all), so it's probably not necessary to mention this point in the commit message. Focus on the code changes being made right here.

Also the commit message is a bit unnatural (the English "take" feels very different than Chinese "取" in this context). Let me tweak it a little bit and please check if it's still conveying the message you intended.

lldb/source/Host/common/NativeProcessProtocol.cpp
510

This is not a plain break, but rather break 0x5 or break BRK_SSTEPBP as the constant/magic 5 comes from Linux/LoongArch asm/break.h. Better reflect this in the comment.

lldb/source/Target/Platform.cpp
1945

Same here.

xen0n retitled this revision from [LLDB][LoongArch] Add LoongArch software breakpoint trap code to [LLDB] Add LoongArch software breakpoint trap opcode.Nov 6 2022, 6:20 PM
xen0n edited the summary of this revision. (Show Details)
seehearfeel retitled this revision from [LLDB] Add LoongArch software breakpoint trap opcode to [LLDB] Add LoongArch software breakpoint trap opcode.
seehearfeel edited the summary of this revision. (Show Details)

Use "break 0x5" in the code comment.

xen0n accepted this revision.Nov 6 2022, 7:13 PM
xen0n retitled this revision from [LLDB] Add LoongArch software breakpoint trap opcode to [LLDB] Add LoongArch software breakpoint trap opcode.
xen0n edited the summary of this revision. (Show Details)

You removed the formatting in the commit message and added an extra space in front of the patch title, all fixed for you.

The changes look good LoongArch-wise now. Thanks!

This revision is now accepted and ready to land.Nov 6 2022, 7:14 PM
This revision was automatically updated to reflect the committed changes.