Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Last active December 30, 2015 02:28
Show Gist options
  • Save tjfontaine/de104fe058300a51f7cf to your computer and use it in GitHub Desktop.
Save tjfontaine/de104fe058300a51f7cf to your computer and use it in GitHub Desktop.
ulimit -c unlimited
./node -pe 'var a = { test: "Hello Node Summit" }; process.abort();'
Aborted (core dumped)
#!/bin/bash
mlogin \
-s /NodeCore/public/linux-cores/mdb-linux.sh \
-s /NodeCore/public/linux-cores/libproc64.so \
-s $1 \
-c "bash /assets/NodeCore/public/linux-cores/mdb-linux.sh /assets/$1" \
$2
./mmdb.sh /NodeCore/public/linux-cores/node-summit-node /NodeCore/public/linux-cores/node-summit-core
* created interactive job -- 7584150a-d174-6dba-f2bf-dd8d830f076d
* waiting for session... established
mdb: warning: librtld_db failed to initialize; shared library information will not be available
> ::load v8
V8 version: 3.14.5.9
Autoconfigured V8 support from target
> ::status
debugging core file of node (64-bit) from unknown machine
file: /assets/NodeCore/public/linux-cores/node-summit-node
initial argv: ./node -pe var a = { test: "Hello Node Summit" }; process.abort();
threading model: raw lwps
status: process terminated with exit status 0
> $r
%rax = 0x0000000000000000 %r8 = 0x00007fff9304cc38
%rbx = 0x0000000001684070 %r9 = 0x0000304d46458101
%rcx = 0xffffffffffffffff %r10 = 0x0000000000000008
%rdx = 0x0000000000000006 %r11 = 0x0000000000000206
%rsi = 0x0000000000007863 %r12 = 0x00000000016d2e00
%rdi = 0x0000000000007863 %r13 = 0x0000000000000000
%r14 = 0x000000000088f7b0
%r15 = 0x00000c533cf091e1
%cs = 0x0033 %fs = 0x0000 %gs = 0x0000
%ds = 0x0000 %es = 0x0000 %ss = 0x002b
%rip = 0x00007fcd67bfbb25
%rbp = 0x00007fff9304cc30
%rsp = 0x00007fff9304caf8
%rflags = 0x00000000
id=0 vip=0 vif=0 ac=0 vm=0 rf=0 nt=0 iopl=0x0
status=<of,df,if,tf,sf,zf,af,pf,cf>
%gsbase = 0x0000000000000000
%fsbase = 0x00007fcd68f37720
%trapno = 0x0
%err = 0x0
> ::walk thread | ::findstack
stack pointer for thread 7863: 7fff9304cc30
[ 00007fff9304cc30 0x7fcd67bfbb25() ]
00007fff9304cd50 _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE+0x1a7()
00007fff9304cd78 0x15b07760618e()
00007fff9304cdb0 0x15b07765239a()
00007fff9304cde8 0x15b0776245e7()
00007fff9304ce70 0x15b0776118b7()
00007fff9304cf00 _ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0xf2()
00007fff9304cf50 v8::internal::Execution::Call+0x79()
00007fff9304cfb0 v8::Script::Run+0x13b()
00007fff9304d050 _ZN4node13WrappedScript11EvalMachineILNS0_14EvalInputFlagsE0ELNS0_16EvalContextFlagsE0ELNS0_15EvalOutputFlagsE0EEEN2v86HandleINS5_5ValueEEERKNS5_9ArgumentsE+0xcf()
00007fff9304d060 node::WrappedScript::CompileRunInThisContext+9()
00007fff9304d180 _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE+0x1a7()
00007fff9304d1a8 0x15b07760618e()
00007fff9304d1f0 0x15b077650ec4()
00007fff9304d258 0x15b0776284fe()
00007fff9304d2c8 0x15b07764e850()
00007fff9304d338 0x15b077646f6c()
00007fff9304d3b0 0x15b07762ce25()
00007fff9304d3e8 0x15b07762c685()
00007fff9304d428 0x15b0776245e7()
00007fff9304d4b0 0x15b0776118b7()
00007fff9304d540 _ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0xf2()
00007fff9304d590 v8::internal::Execution::Call+0x79()
00007fff9304d600 v8::Function::Call+0x10c()
00007fff9304d670 node::Load+0xea()
00007fff9304d700 node::Start+0x143()
0000000000000000 0x7fcd67be6c4d()
> $G
C++ symbol demangling enabled
> ::jsstack
7fff9304cc30 0x7fcd67bfbb25
7fff9304cd50 _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE+0x1a7
7fff9304cd78 0x15b07760618e internal (Code: 15b0776060e1)
7fff9304cdb0 0x15b07765239a <anonymous> (as <anon>) (304d46473159)
7fff9304cde8 0x15b0776245e7 <InternalFrame>
7fff9304ce70 0x15b0776118b7 <EntryFrame>
7fff9304cf00 _ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0xf2
7fff9304cf50 v8::internal::Execution::Call+0x79
7fff9304cfb0 v8::Script::Run+0x13b
7fff9304d050 _ZN4node13WrappedScript11EvalMachineILNS0_14EvalInputFlagsE0ELNS0_16EvalContextFlagsE0ELNS0_15EvalOutputFlagsE0EEEN2v86HandleINS5_5ValueEEERKNS5_9ArgumentsE+0xcf
7fff9304d060 node::WrappedScript::CompileRunInThisContext+9
7fff9304d180 _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE+0x1a7
7fff9304d1a8 0x15b07760618e internal (Code: 15b0776060e1)
7fff9304d1f0 0x15b077650ec4 <anonymous> (as <anon>) (c533cf4ad59)
7fff9304d258 0x15b0776284fe <InternalFrame>
7fff9304d2c8 0x15b07764e850 <anonymous> (as Module._compile) (304d46471209)
7fff9304d338 0x15b077646f6c evalScript (c533cf12179)
7fff9304d3b0 0x15b07762ce25 startup (c533cf12101)
7fff9304d3e8 0x15b07762c685 <anonymous> (as <anon>) (c533cf12021)
7fff9304d428 0x15b0776245e7 <InternalFrame>
7fff9304d4b0 0x15b0776118b7 <EntryFrame>
7fff9304d540 _ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0xf2
7fff9304d590 v8::internal::Execution::Call+0x79
7fff9304d600 v8::Function::Call+0x10c
7fff9304d670 node::Load+0xea
7fff9304d700 node::Start+0x143
> ::findjsobjects -p test | ::jsprint
{
test: "Hello Node Summit",
}
@KylePDavis
Copy link

Trying to figure out how to do this on our own SmartOS installation with a core dump from a Linux machine.
Could you provide the actual mdb command being executed above? I think that is the missing link.

@KylePDavis
Copy link

Thanks for the writeup over on the Joyent blog:

@MrNice
Copy link

MrNice commented Jan 19, 2015

Following the same instructions on a 64 bit ubuntu install running on virtualbox.

nicholas@local-nicholas-nicholass-pro:~$ uname -a
Linux local-nicholas-nicholass-pro 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I get this error

./mmdb.sh ~~/stor/debug.tar.gz
 * created interactive job -- 0266a318-f857-caf6-a5e5-b2c41a5b9395
 * waiting for session...   established
mdb: cannot debug core: core file is corrupt or missing required data
mdb: failed to initialize target: No such file or directory


 * remote process exited
 * cleaning up resources...
 * session complete

I'm uncertain how to proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment