You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
configuration option --gdb not working properly #2076
@bnoordhuis Sorry to pull you in on this one, but cannot figure out how a build of iojs with --gdb would show no output, but a build of same patch version of d8 with it enabled would show the JS output. Any thoughts where I could dig to find the answer?
EDIT: Interesting note that d8 shows similar output to iojs if the --gdbjit-full is removed. Wonder if additional information isn't being emitted to gdb.
This should give you the javascript stacktrace (with a lot more verbose information). Note that you don't really need to reconfigure with --gdb for this to work.
@trevnorris Do you know the last time --gdbjit and --gdbjit-full worked for you? I can go all the way back to 1.0.0 and it still doesn't work. Whatever is broken, hasn't broken recently.
Looking at the V8 code in gdb-jit.cc, I don't see anything obviously wrong, and as you mention d8 seems to work okay. Also, I have verified, using --gdbjit-dump that the object files being produced by gdb-jit.cc have decent symbols.
My suspicion is that there is something different about memory layout/map for the node process that confuses gdb somehow.
Maybe worth installing gdbinit to $PREFIX/share/io.js, documenting it's use? It's not impossible to crash iojs / nodejs so this seems useful, especially if it can be used without recompiling iojs.
@coreyfarrell 👍. It is much easier to use gdbinit than recompiling with --gdb. Jit support in gdb happens to be buggy and slow anyway. PRs are welcome, or I will try to do it once I get a chance.
@bnoordhuis gdbjit still doesn't seem to work for me with node in next, or any release of io.js (that I tried) going back to 1.0. Note that it does work with d8 in atleast 4.2. I think this is something node-specific, but I am not entirely sure what yet.
@ofrobots The issue with current master and next are different. In master I can hit the __jit_debug_register_code breakpoint, but no bt output. In next branch the breakpoint is never reached.
node v0.11.9 would show the first JS point in the backtrace output with gdb. Back at that time I would use lldb because the output was more comprehensive. Then lldb for linux x64 got borked and I stopped using the feature.
Recently gave it a shot against d8 and found that it mostly worked. Though both options must be passed. But even with both options passed to io.js the end of the stack looks like so:
#8 0x000027ddf1006001 in ?? ()
#9 0x00007fffffffd530 in ?? ()
#10 0x00007fffffffd598 in ?? ()
#11 0x000027ddf10e864e in zzz ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I think this is a gdb-related issue. This is how far I got:
V8 is reporting the code-compile events to gdb by calling __jit_debug_register_code. If you enable internal gdb debugging using the set debug jit 1 command, you can see that gdb acknowledges the receipt of these symbols. However, for some reason it doesn't use them during the backtrace. I am not sure why this works with d8 but not node.
As for gdbjit, IIRC it was useful to be able to step through the JS source in gdb. gdbinit definitely gives more information, but being able to step through the JS itself in gdb was also useful.
Okay, that is a reasonable use-case. I don't have bandwidth at the moment, but I will try to take another look when I get some spare cycles. Others are welcome to investigate this too.
This is excellent we can walk through the JS on a release build.
Unfortunately on master building with ./configure --gdb --debug and adding CXXFLAGS="-g" we still can't get any information even running the debug build. I've attempted to fix this several times, since this functionality could greatly improve certain debugging cases, but haven't figured out what's going on. I'd love if someone else could pick this up and figure out what's wrong.
Activity
trevnorris commentedon Jun 29, 2015
Running the same script with current master I get the following stack trace:
So even though the breakpoint is hit on master, it doesn't give us any information. Though d8 on the head of 4.2 branch gives:
Not sure how this could be happening.
trevnorris commentedon Jun 29, 2015
@bnoordhuis Sorry to pull you in on this one, but cannot figure out how a build of iojs with
--gdbwould show no output, but a build of same patch version of d8 with it enabled would show the JS output. Any thoughts where I could dig to find the answer?EDIT: Interesting note that d8 shows similar output to iojs if the
--gdbjit-fullis removed. Wonder if additional information isn't being emitted to gdb.ofrobots commentedon Jun 29, 2015
@trevnorris I'll try to reproduce. In the meanwhile there is another trick you can try. After you have hit the out-of-memory abort, run this in gdb:
This should give you the javascript stacktrace (with a lot more verbose information). Note that you don't really need to reconfigure with
--gdbfor this to work.ofrobots commentedon Jun 30, 2015
@trevnorris Do you know the last time --gdbjit and --gdbjit-full worked for you? I can go all the way back to 1.0.0 and it still doesn't work. Whatever is broken, hasn't broken recently.
Looking at the V8 code in gdb-jit.cc, I don't see anything obviously wrong, and as you mention d8 seems to work okay. Also, I have verified, using
--gdbjit-dumpthat the object files being produced by gdb-jit.cc have decent symbols.My suspicion is that there is something different about memory layout/map for the node process that confuses gdb somehow.
ofrobots commentedon Jun 30, 2015
Removed the build tag as the
--gdbconfigure option does correctly enable gdb support in V8.bnoordhuis commentedon Jun 30, 2015
I'm not 100% sure but I believe gdbjit was broken until 4.3. The commit that fixes it (if I'm right) is v8/v8@652061e and is in next.
coreyfarrell commentedon Jun 30, 2015
Maybe worth installing gdbinit to $PREFIX/share/io.js, documenting it's use? It's not impossible to crash iojs / nodejs so this seems useful, especially if it can be used without recompiling iojs.
ofrobots commentedon Jun 30, 2015
@coreyfarrell 👍. It is much easier to use gdbinit than recompiling with
--gdb. Jit support in gdb happens to be buggy and slow anyway. PRs are welcome, or I will try to do it once I get a chance.ofrobots commentedon Jun 30, 2015
@bnoordhuis gdbjit still doesn't seem to work for me with node in next, or any release of io.js (that I tried) going back to 1.0. Note that it does work with d8 in atleast 4.2. I think this is something node-specific, but I am not entirely sure what yet.
trevnorris commentedon Jun 30, 2015
@ofrobots The issue with current
masterandnextare different. InmasterI can hit the__jit_debug_register_codebreakpoint, but nobtoutput. Innextbranch the breakpoint is never reached.node v0.11.9 would show the first JS point in the backtrace output with
gdb. Back at that time I would uselldbbecause the output was more comprehensive. Thenlldbfor linux x64 got borked and I stopped using the feature.Recently gave it a shot against d8 and found that it mostly worked. Though both options must be passed. But even with both options passed to io.js the end of the stack looks like so:
ofrobots commentedon Jun 30, 2015
I think this is a gdb-related issue. This is how far I got:
V8 is reporting the code-compile events to gdb by calling
__jit_debug_register_code. If you enable internal gdb debugging using theset debug jit 1command, you can see that gdb acknowledges the receipt of these symbols. However, for some reason it doesn't use them during the backtrace. I am not sure why this works with d8 but not node.The above was with io.js @ master. To compare I used a d8 from branch-heads/4.2.
Fishrock123 commentedon Aug 25, 2015
Is this still not working correctly?
3 remaining items
trevnorris commentedon Aug 25, 2015
As for
gdbjit, IIRC it was useful to be able to step through the JS source in gdb.gdbinitdefinitely gives more information, but being able to step through the JS itself in gdb was also useful.ofrobots commentedon Aug 25, 2015
Okay, that is a reasonable use-case. I don't have bandwidth at the moment, but I will try to take another look when I get some spare cycles. Others are welcome to investigate this too.
ofrobots commentedon Aug 25, 2015
Self-assigning so that I don't forget, but others are welcome to investigate it too.
trevnorris commentedon Aug 25, 2015
Thanks. Seems it has to be something like build configuration. Since it works perfectly in d8. I'll also try to take a peek there.
Trott commentedon Mar 23, 2016
Any chance someone knows if this is resolved or still an issue?
trevnorris commentedon Mar 23, 2016
@Trott This unfortunately is still an issue. Building d8@4.9.385.27 (same as current master) and running the simple script:
and executing with:
we can see a significant amount of information. For example:
This is excellent we can walk through the JS on a release build.
Unfortunately on master building with
./configure --gdb --debugand addingCXXFLAGS="-g"we still can't get any information even running the debug build. I've attempted to fix this several times, since this functionality could greatly improve certain debugging cases, but haven't figured out what's going on. I'd love if someone else could pick this up and figure out what's wrong.deps: backport 8d00c2c from v8 upstream
trevnorris commentedon Mar 23, 2016
@bnoordhuis Awesome. Thanks much for taking care of this.
deps: backport 8d00c2c from v8 upstream
deps: backport 8d00c2c from v8 upstream
deps: backport 8d00c2c from v8 upstream