Hi all,
I'm following [1] to debug builtins (specifically `InterpreterEntryTrampoline`) with gdb. But it segfaults when I step through the code. After checking the assembly it turns out that the instruction has been modified.
The desired instructions provided by `--print-builtin-code` are as follows:
kind = BUILTIN
name = InterpreterEntryTrampoline
compiler = unknown
address = 0x171700005181
...
Instructions (size = 1584)
0x171707687180 0 448b570b movl r10,[rdi+0xb]
0x171707687184 4 4d03d6 REX.W addq r10,r14
...
but as shown in gdb, %r10 is replaced with %edx in the first instruction:
0x223e07687181 mov 0xb(%rdi),%edx
0x223e07687184 add %r14,%r10
...
When I run the program without setting breakpoint on `Builtins_InterpreterEntryTrampoline` in gdb, it exits normally. [1] mentioned that "GDB modifies the binary". I'm wondering if gdb is modifying the memory content here? How can I prevent this?
I also tried lldb, but after setting the breakpoint on `Builtins_InterpreterEntryTrampoline`, it didn't stop at this function.
I'm using Ubuntu 20.04 with gdb 9.2 and lldb 10.0. Any help would be much appreciated.
Regards,
Jiading
is_component_build = true
is_debug = true
symbol_level = 2
target_cpu = "x64"
use_goma = false
v8_enable_backtrace = true
v8_enable_fast_mksnapshot = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
```
[3] foo.js:
function foo() { return 1; }
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
foo();