__jit_debug_register_code was not invoked in debug build

67 views
Skip to first unread message

Mingwei Zhang

unread,
Jun 17, 2018, 5:15:20 PM6/17/18
to v8-users
Dear V8 developer,

I recently tried to use the debugging interface for gdb on JIT code. When I tried building a debug build of V8 and following the instructions in:


I launched my program using the following command:

gdb --args ./d8 --gdbjit helloworld.js

In the gdb prompt, I setup a breakpoint in __jit_debug_register_code before launch my program, but looks like the hook was never invoked.

I am using gdb 7.11 in Ubuntu 16.04.
d8 version 6.7.0 (candidate)

My helloworld.js is very simple like this:
function func() {
        console.log('hello');
}

func()


Thanks.

Ben Noordhuis

unread,
Jun 18, 2018, 6:20:44 PM6/18/18
to v8-users
You don't have to set a breakpoint in __jit_debug_register_code, gdb
does that for you. It's a magic method that gdb recognizes, see
https://sourceware.org/gdb/onlinedocs/gdb/Declarations.html for
details.

That said, the gdbjit code is unmaintained - or at least not regularly
tested - and quite possibly broken. YMMV.

Mingwei Zhang

unread,
Jun 18, 2018, 10:11:27 PM6/18/18
to v8-users
Hi Ben,

The problem is that I don't get any breakpoint hit notification in gdb. The program just execute and exited normally, regardless of whether i set the breakpoint or not in __jit_debug_register_code.

I double checked in instructions that when I am using gm.py with target x64.debug, it does use the option ENABLE_GDB_JIT_INTERFACE.

So, then I am very confused why I don't get breakpoint hit in gdb.

Appreciate your help.

Ben Noordhuis

unread,
Jun 19, 2018, 5:45:38 AM6/19/18
to v8-users
On Tue, Jun 19, 2018 at 4:11 AM, Mingwei Zhang <mingwa...@gmail.com> wrote:
> Hi Ben,
>
> The problem is that I don't get any breakpoint hit notification in gdb. The
> program just execute and exited normally, regardless of whether i set the
> breakpoint or not in __jit_debug_register_code.
>
> I double checked in instructions that when I am using gm.py with target
> x64.debug, it does use the option ENABLE_GDB_JIT_INTERFACE.
>
> So, then I am very confused why I don't get breakpoint hit in gdb.
>
> Appreciate your help.

Do things go better when you also pass --gdbjit_full to d8? If not,
I'd say it's safe to assume the code has bitrotted (but fix-up CLs
undoubtedly welcome in that case.)

Mingwei

unread,
Jun 19, 2018, 7:40:13 PM6/19/18
to v8-u...@googlegroups.com
No. it does not. Neither --gdbjit or --gdbjit_full works on d8.

One thing I noticed is that in this version of d8, I am not seeing any
RWX code pages. Obviously, V8 enforces W^X policy on JIT code pages.
But I am not sure if this is the reason for that.

Let me know. Thanks.

best
> --
> --
> v8-users mailing list
> v8-u...@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Mingwei Zhang
Reply all
Reply to author
Forward
0 new messages