I have a script like this script = GF1_dd_Daemon_Sh PROCESS_NAME=RG INSTANCE=RG PART_ID=1
Inside this there is an executable which is called. When I run this script(#!/bin/ksh ) it creates a core dump and using dbx when i analyse the stack trace I cannot get any much info.
Is there any way to run the script using DBX and can trace the point where the executable is creating the core dump.
I am using SOLARIS.
Thanks.
Stack Trace
(dbx) where
current thread: t@1
[1] xercesc_2_6::SAXParser::SAXParser(0xffffffff70b833b8, 0xffffffff70b83480, 0x0, 0x0, 0xffffffff70b833f8, 0xffffffff7d12ccd8), at 0xffffffff7ce22fc0
=>[2] __SLIP.INIT_D() (optimized), at 0xffffffff70a447b8 (line ~35) in "Parser.h"
[3] __STATIC_CONSTRUCTOR() (optimized), at 0xffffffff70a46f04 (line ~35) in "Parser.h"
[4] 0xffffffff70a74718(0xffffffff7f7361b8, 0xffffffff7f738d60, 0x11a340, 0x0, 0xffffffff7f736c60, 0x821), at 0xffffffff70a74718
[5] call_init(0xffffffff7f736530, 0x1, 0xffffffff70a74618, 0xffdfffff, 0xffffffff7f736c60, 0xffffffffffffffff), at 0xffffffff7f618674
[6] dlmopen_intn(0xffffffff7ffe6b0c, 0x8, 0x4a, 0x52, 0xffffffff7ffe6b0c, 0xffffffff77800a60), at 0xffffffff7f61df7c
[7] dlmopen_check(0xffffffff7f7361b8, 0xffffffff7ffe6c18, 0x1, 0xffffffff7f400ef0, 0xffffffff7ffe6b0c, 0x118cc8), at 0xffffffff7f61e0f0
[8]开发者_开发技巧 _dlopen(0xffffffff7ffe6c18, 0x1, 0x1, 0xffffffff7ea56d30, 0x11, 0xffffffff7fffc226), at 0xffffffff7f61e130
[9] GMF_sfg_ACTIVITY(i_pgmName = ???, i_instance = ???, i_coreReplaceRegister_func_p = ???) (optimized), at 0xffffffff7e926ff0 (line ~200) in "GMF_sfg_ACTIVITY.c"
[10] GMF_mdg_EXECinit(i_pcProcessName = ???, i_argc = ???, i_argv = ???) (optimized), at 0xffffffff7eb33394 (line ~556) in "GMF_mdg_EXECinit.c"
[11] GMF_mdg_EXECmain(argc = ???, argv = ???) (optimized), at 0xffffffff7eb25ae8 (line ~163) in "GMF_mdg_EXECfunc.c"
[12] main(argc = ???, argv = ???) (optimized), at 0x100001eb8 (line ~52) in "GMF_mdg_EXECproc.c"
(dbx) down
0xffffffff7ce22fc0: SAXParser+0x0110: ldx [%i2], %o3
One common approach is to add a variable to the script called something like $DEBUGGER
#!/bin/sh
echo "this is the script"
$DEBUGGER the_executable arg1 arg2
If you set the DEBUGGER environment variable to "dbx", then when you run the script, dbx will be started and it will give you a dbx prompt.
If you're using the Solaris Studio IDE, you can use "ss_attach" instead of "dbx" and it will attach the debugging session to an IDE that is already running.
Check the man page for ss_attach.
- Inside the script check what are the arguments that are being passed to the executable (binary).
- start the dbx with that executable
- after it start set the arguments which you have discovered in step 1
- stop in GMF_mdg_EXECmain
- then start checking the code flow
精彩评论