Skip to content

Commit

Permalink
Merge pull request JuliaLang#14559 from JuliaLang/yyc/export-debug
Browse files Browse the repository at this point in the history
Make sure JL_DLLEXPORT debugging helper functions are actually exported
  • Loading branch information
JeffBezanson committed Jan 5, 2016
2 parents 84a4b3f + d0c8343 commit ce1e856
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/devdocs/debuggingtips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ there are a number of additional variables (see julia.h for a complete list) tha
Useful Julia functions for Inspecting those variables
-----------------------------------------------------

- ``gdblookup($rip)`` :: For looking up the current function and line. (use ``$eip`` on i686 platforms)
- ``jl_gdblookup($rip)`` :: For looking up the current function and line. (use ``$eip`` on i686 platforms)
- ``jlbacktrace()`` :: For dumping the current julia backtrace stack to stderr. Only usable after ``record_backtrace()`` has been called.
- ``jl_dump_llvm_value(Value*)`` :: For invoking ``Value->dump()`` in gdb, where it doesn't work natively. For example, ``f->linfo->functionObject``, ``f->linfo->specFunctionObject``, and ``to_function(f->linfo)``.
- ``Type->dump()`` :: only works in lldb. Note: add something like ``;1`` to prevent lldb from printing its prompt over the output
Expand Down
1 change: 1 addition & 0 deletions src/julia.expmap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
iswprint;
jl_*;
rec_backtrace;
rec_backtrace_ctx;
julia_*;
libsupport_init;
localtime_r;
Expand Down
2 changes: 1 addition & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ JL_DLLEXPORT void attach_exception_port(void);
void jl_getFunctionInfo(char **name, char **filename, size_t *line,
char **inlinedat_file, size_t *inlinedat_line,
uintptr_t pointer, int *fromC, int skipC, int skipInline);
JL_DLLEXPORT void gdblookup(ptrint_t ip);
JL_DLLEXPORT void jl_gdblookup(ptrint_t ip);

// *to is NULL or malloc'd pointer, from is allowed to be NULL
static inline char *jl_copy_str(char **to, const char *from)
Expand Down
2 changes: 1 addition & 1 deletion src/signal-handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void jl_critical_error(int sig, bt_context_t context, ptrint_t *bt_data,
if (context)
*bt_size = n = rec_backtrace_ctx(bt_data, JL_MAX_BT_SIZE, context);
for(size_t i=0; i < n; i++)
gdblookup(bt_data[i]);
jl_gdblookup(bt_data[i]);
gc_debug_print_status();
}

Expand Down
4 changes: 1 addition & 3 deletions src/signals-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#define sig_stack_size 131072 // 128k reserved for SEGV handling
static BOOL (*pSetThreadStackGuarantee)(PULONG);

JL_DLLEXPORT void gdblookup(ptrint_t ip);

// Copied from MINGW_FLOAT_H which may not be found due to a collision with the builtin gcc float.h
// eventually we can probably integrate this into OpenLibm.
#if defined(_COMPILER_MINGW_)
Expand Down Expand Up @@ -220,7 +218,7 @@ static LONG WINAPI _exception_handler(struct _EXCEPTION_POINTERS *ExceptionInfo,
jl_safe_printf("UNKNOWN"); break;
}
jl_safe_printf(" at 0x%Ix -- ", (size_t)ExceptionInfo->ExceptionRecord->ExceptionAddress);
gdblookup((ptrint_t)ExceptionInfo->ExceptionRecord->ExceptionAddress);
jl_gdblookup((ptrint_t)ExceptionInfo->ExceptionRecord->ExceptionAddress);

jl_critical_error(0, ExceptionInfo->ContextRecord, jl_bt_data, &jl_bt_size);
static int recursion = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ JL_DLLEXPORT jl_value_t *jl_get_backtrace(void)
}

//for looking up functions from gdb:
JL_DLLEXPORT void gdblookup(ptrint_t ip)
JL_DLLEXPORT void jl_gdblookup(ptrint_t ip)
{
char *func_name;
size_t line_num;
Expand Down Expand Up @@ -794,11 +794,11 @@ JL_DLLEXPORT void gdblookup(ptrint_t ip)
JL_DLLEXPORT void jlbacktrace(void)
{
size_t n = jl_bt_size; // jl_bt_size > 40 ? 40 : jl_bt_size;
for(size_t i=0; i < n; i++)
gdblookup(jl_bt_data[i]);
for (size_t i=0; i < n; i++)
jl_gdblookup(jl_bt_data[i]);
}

JL_DLLEXPORT void gdbbacktrace(void)
JL_DLLEXPORT void jl_gdbbacktrace(void)
{
record_backtrace();
jlbacktrace();
Expand Down

0 comments on commit ce1e856

Please sign in to comment.