@@ -287,6 +287,31 @@ namespace std
287
287
288
288
using namespace ABI_NAMESPACE ;
289
289
290
+ /* *
291
+ * Callback function used with _Unwind_Backtrace().
292
+ *
293
+ * Prints a stack trace. Used only for debugging help.
294
+ *
295
+ * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only
296
+ * correctly prints function names from public, relocatable, symbols.
297
+ */
298
+ static _Unwind_Reason_Code trace (struct _Unwind_Context *context, void *c)
299
+ {
300
+ Dl_info myinfo;
301
+ int mylookup =
302
+ dladdr (reinterpret_cast <void *>(__cxa_current_exception_type), &myinfo);
303
+ void *ip = reinterpret_cast <void *>(_Unwind_GetIP (context));
304
+ Dl_info info;
305
+ if (dladdr (ip, &info) != 0 )
306
+ {
307
+ if (mylookup == 0 || strcmp (info.dli_fname , myinfo.dli_fname ) != 0 )
308
+ {
309
+ printf (" %p:%s() in %s\n " , ip, info.dli_sname , info.dli_fname );
310
+ }
311
+ }
312
+ return _URC_CONTINUE_UNWIND;
313
+ }
314
+
290
315
static void bt_terminate_handler () {
291
316
__cxa_eh_globals* globals = __cxa_get_globals ();
292
317
__cxa_exception* thrown_exception = globals->caughtExceptions ;
@@ -759,31 +784,6 @@ void __cxa_free_dependent_exception(void *thrown_exception)
759
784
free_exception (reinterpret_cast <char *>(thrown_exception) - dependent_exception_size - backtrace_buffer_size);
760
785
}
761
786
762
- /* *
763
- * Callback function used with _Unwind_Backtrace().
764
- *
765
- * Prints a stack trace. Used only for debugging help.
766
- *
767
- * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only
768
- * correctly prints function names from public, relocatable, symbols.
769
- */
770
- static _Unwind_Reason_Code trace (struct _Unwind_Context *context, void *c)
771
- {
772
- Dl_info myinfo;
773
- int mylookup =
774
- dladdr (reinterpret_cast <void *>(__cxa_current_exception_type), &myinfo);
775
- void *ip = reinterpret_cast <void *>(_Unwind_GetIP (context));
776
- Dl_info info;
777
- if (dladdr (ip, &info) != 0 )
778
- {
779
- if (mylookup == 0 || strcmp (info.dli_fname , myinfo.dli_fname ) != 0 )
780
- {
781
- printf (" %p:%s() in %s\n " , ip, info.dli_sname , info.dli_fname );
782
- }
783
- }
784
- return _URC_CONTINUE_UNWIND;
785
- }
786
-
787
787
/* *
788
788
* Report a failure that occurred when attempting to throw an exception.
789
789
*
0 commit comments