leocheang422 / exceptions4c

Automatically exported from code.google.com/p/exceptions4c
0 stars 0 forks source link

Wiki enhancement: an example of adding backtrace info to exception frames #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think this can be useful to many users, and I hope you consider adding it! 
It's a good example of using e4c's custom_data field.

Notes:

* It relies on gcc's backtrace functionality: 
http://www.gnu.org/software/libc/manual/html_node/Backtraces.html
* Still, the principle can be adapted to other compilers and stacktrace 
libraries, so I think it's a useful example.
* To add function names to the backtrace, you need to link using the 
"-rdynamic" flag.
* gcc doesn't support line numbers in the backtrace, but you can retrieve these 
using the external addr2line utility.

Original issue reported on code.google.com by tal.liron on 19 May 2014 at 5:06

Attachments:

GoogleCodeExporter commented 8 years ago
Hey, your contribution is great! Of course I will add it to the repository.

That's the exact use case I had in mind when I added the custom data 
functionality; in fact, I coded a small proof of concept:

 * https://code.google.com/p/exceptions4c/source/browse/trunk/etc/e4c_st_g.h
 * https://code.google.com/p/exceptions4c/source/browse/trunk/etc/e4c_st_g.c

But I did not have the time to document it :(

By the way, would you like to add some licensing/authoring info to the file, or 
should I commit it to the repo as it is?

Thanks a lot!

Original comment by guillermocalvo on 19 May 2014 at 7:26

GoogleCodeExporter commented 8 years ago
Thanks! You can add "Original code contributed by Tal Liron 
<tal.liron@gmail.com>", and the copyright can remain the same as the rest of 
the e4c code.

Original comment by tal.liron on 19 May 2014 at 7:32

GoogleCodeExporter commented 8 years ago
Cool! I will do it, as soon as I get home...

In the meantime, I've just added you to the list of project committers; feel 
free to push changes if you want :)

Thanks again

Original comment by guillermocalvo on 19 May 2014 at 7:35

GoogleCodeExporter commented 8 years ago

Original comment by guillermocalvo on 19 May 2014 at 7:29