nddrylliog/rock — Issue #332: Improve stack traces
Author: nddrylliog
Created: 2011-10-18 12:01:42+00:00
State: open
Labels: Feature

Currently, here's what happens when we don't use -g +-rdynamic

amos@stables ~ % ooc/incli/incli sdoifj
[Exception in FileReader]: Couldn't open incli.config for reading.
[backtrace]
ooc/incli/incli[0x405cb7]
ooc/incli/incli[0x40611d]
ooc/incli/incli[0x40606b]
ooc/incli/incli[0x4061ae]
ooc/incli/incli[0x419329]
ooc/incli/incli[0x419296]
ooc/incli/incli[0x4196ff]
ooc/incli/incli[0x41f11c]
ooc/incli/incli[0x41f3f0]
ooc/incli/incli[0x403520]
ooc/incli/incli[0x403615]
ooc/incli/incli[0x403645]
ooc/incli/incli[0x403bb8]
/lib/libc.so.6(__libc_start_main+0xfe)[0x2b46dea20d8e]
ooc/incli/incli[0x402ce9]
[1] 1870 abort (core dumped) ooc/incli/incli sdoifj
134 amos@stables ~ % :(

If we have -g +rdynamic, here's what we see:

amos@stables ~ % ooc/incli/incli sdoifj
[Exception in FileReader]: Couldn't open incli.config for reading.
[backtrace]
ooc/incli/incli(lang_Exception__Exception_addBacktrace_impl+0x48)[0x428367]
ooc/incli/incli(lang_Exception__Exception_addBacktrace+0x20)[0x4287cd]
ooc/incli/incli(lang_Exception__Exception_throw_impl+0x24)[0x42871b]
ooc/incli/incli(lang_Exception__Exception_throw+0x23)[0x42885e]
ooc/incli/incli(io_FileReader__FileReader_init_withMode+0x91)[0x43b9d9]
ooc/incli/incli(io_FileReader__FileReader_init_withName+0x2a)[0x43b946]
ooc/incli/incli(io_FileReader__FileReader_new_withName+0x41)[0x43bdaf]
ooc/incli/incli(config__Config_init+0x1c)[0x441850]
ooc/incli/incli(config__Config_new+0x41)[0x441b7a]
ooc/incli/incli(incli__Incli___defaults___impl+0x3c)[0x425bd0]
ooc/incli/incli(incli__Incli___defaults__+0x20)[0x425cc5]
ooc/incli/incli(incli__Incli_new+0x2e)[0x425cf5]
ooc/incli/incli(main+0x89)[0x426268]
/lib/libc.so.6(__libc_start_main+0xfe)[0x2b8b2885ad8e]
ooc/incli/incli[0x425399]
[1] 5688 abort (core dumped) ooc/incli/incli sdoifj
134 amos@stables ~ %

But we can still improve that a lot - we can turn things like

ooc/incli/incli(io_FileReader__FileReader_init_withMode+0x91)[0x43b9d9]

Into

ooc/incli/incli(FileReader init~withMode() in io/FileReader)[0x43b9d9]

And we can use addr2line like this:

amos@stables ~ % addr2line -e ooc/incli/incli --address 0x43b9d9 0x428367
0x000000000043b9d9
/opt/rock/sdk/io/FileReader.ooc:52
0x0000000000428367
/opt/rock/sdk/lang/Exception.ooc:141
amos@stables ~ % addr2line -e ooc/incli/incli --address 0x428367 0x4287cd 0x42871b 0x42885e 0x43bdaf 0x441850 0x441b7a 0x425bd0 0x425cc5 0x425cf5 0x426268
0x0000000000428367
/opt/rock/sdk/lang/Exception.ooc:141
0x00000000004287cd
/opt/rock/sdk/lang/Exception.ooc:241
0x000000000042871b
/opt/rock/sdk/lang/Exception.ooc:218
0x000000000042885e
/opt/rock/sdk/lang/Exception.ooc:257
0x000000000043bdaf
/opt/rock/sdk/io/FileReader.ooc:28
0x0000000000441850
/home/amos/.jenkins/jobs/instastream-uploading/workspace/config/config.ooc:8
0x0000000000441b7a
/home/amos/.jenkins/jobs/instastream-uploading/workspace/config/config.ooc:7
0x0000000000425bd0
/home/amos/ooc/incli/./incli.ooc:136
0x0000000000425cc5
/home/amos/ooc/incli/./incli.ooc:155
0x0000000000425cf5
/home/amos/ooc/incli/./incli.ooc:43
0x0000000000426268
/home/amos/ooc/incli/./incli.ooc:1
amos@stables ~ %

And that, my friends, is freaking awesome