зеркало из https://github.com/github/ruby.git
YJIT: Use a special breakpoint address if one isn't explicitly supplied in order to support natural line stepping. (#11083)
Use a special breakpoint address if one isn't explicitly supplied in order to support natural line stepping. ARM64 will not increment the program counter (PC) upon hitting a breakpoint instruction. Consequently, stepping through code with a debugger ends up looping back to the breakpoint instruction. LLDB has a special breakpoint address of 0xf000 that will increment the PC and allow the debugger to work as expected. This change makes it possible to debug YJIT generated code on ARM64. More details at: https://discourse.llvm.org/t/stepping-over-a-brk-instruction-on-arm64/69766/8 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
Родитель
2830a6ae38
Коммит
3407565d2f
|
@ -257,7 +257,7 @@ pub fn br(cb: &mut CodeBlock, rn: A64Opnd) {
|
||||||
/// BRK - create a breakpoint
|
/// BRK - create a breakpoint
|
||||||
pub fn brk(cb: &mut CodeBlock, imm16: A64Opnd) {
|
pub fn brk(cb: &mut CodeBlock, imm16: A64Opnd) {
|
||||||
let bytes: [u8; 4] = match imm16 {
|
let bytes: [u8; 4] = match imm16 {
|
||||||
A64Opnd::None => Breakpoint::brk(0).into(),
|
A64Opnd::None => Breakpoint::brk(0xf000).into(),
|
||||||
A64Opnd::UImm(imm16) => {
|
A64Opnd::UImm(imm16) => {
|
||||||
assert!(uimm_fits_bits(imm16, 16), "The immediate operand must be 16 bits or less.");
|
assert!(uimm_fits_bits(imm16, 16), "The immediate operand must be 16 bits or less.");
|
||||||
Breakpoint::brk(imm16 as u16).into()
|
Breakpoint::brk(imm16 as u16).into()
|
||||||
|
@ -1335,7 +1335,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_brk_none() {
|
fn test_brk_none() {
|
||||||
check_bytes("000020d4", |cb| brk(cb, A64Opnd::None));
|
check_bytes("00003ed4", |cb| brk(cb, A64Opnd::None));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче