Skip to content

Commit 66a3f24

Browse files
georgthegreatblinkov
authored andcommitted
Split fix_trace_format.patch for a cleaner diff.
This reverts commit 4358151e7723e37a39cf6f5478bfa336aa687fd4, reversing changes made to ad7618a2219d22bcd89a67fe082f290b4a9656ef. commit_hash:abd312d0c2cdc5ee542823f99f8f57a7bcd29f9c
1 parent bc0c97c commit 66a3f24

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

contrib/libs/cxxsupp/libcxxrt/exception.cc

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,31 @@ namespace std
287287

288288
using namespace ABI_NAMESPACE;
289289

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+
290315
static void bt_terminate_handler() {
291316
__cxa_eh_globals* globals = __cxa_get_globals();
292317
__cxa_exception* thrown_exception = globals->caughtExceptions;
@@ -759,31 +784,6 @@ void __cxa_free_dependent_exception(void *thrown_exception)
759784
free_exception(reinterpret_cast<char*>(thrown_exception) - dependent_exception_size - backtrace_buffer_size);
760785
}
761786

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-
787787
/**
788788
* Report a failure that occurred when attempting to throw an exception.
789789
*

0 commit comments

Comments
 (0)