@@ -24,7 +24,7 @@ Similarly, if you're debugging some of julia's internals (e.g.,
24
24
25
25
This is a good way to circumvent problems that arise from the order in which julia's output streams are initialized.
26
26
27
- Julia's flisp interpreter uses ``value_t* `` objects; these can be displayed
27
+ Julia's flisp interpreter uses ``value_t `` objects; these can be displayed
28
28
with ``call fl_print(ios_stdout, obj) ``.
29
29
30
30
Useful Julia variables for Inspecting
@@ -74,7 +74,7 @@ Another useful frame is ``to_function(jl_lambda_info_t *li, bool cstyle)``. The
74
74
75
75
#2 0x00007ffff7928bf7 in to_function (li=0x2812060, cstyle=false) at codegen.cpp:584
76
76
584 abort();
77
- (gdb) p jl_(jl_uncompress_ast(li, li. ast))
77
+ (gdb) p jl_(jl_uncompress_ast(li, li-> ast))
78
78
79
79
Inserting breakpoints upon certain conditions
80
80
---------------------------------------------
@@ -91,10 +91,31 @@ Calling a particular method
91
91
92
92
::
93
93
94
- (gdb) break jl_apply_generic if strcmp(F ->name->name , "method_to_break")==0
94
+ (gdb) break jl_apply_generic if strcmp((char*)(jl_symbol_name)(jl_gf_mtable(F) ->name) , "method_to_break")==0
95
95
96
96
Since this function is used for every call, you will make everything 1000x slower if you do this.
97
97
98
+ Dealing with signals
99
+ --------------------
100
+
101
+ Julia requires a few signal to function property. The profiler uses ``SIGUSR2 ``
102
+ for sampling and the garbage collector uses ``SIGSEGV `` for threads
103
+ synchronization. If you are debugging some code that uses the profiler or
104
+ multiple julia threads, you may want to let the debugger ignore these signals
105
+ since they can be triggered very often during normal operations. The command to
106
+ do this in GDB is (replace ``SIGSEGV `` with ``SIGUSRS `` or other signals you
107
+ want to ignore)::
108
+
109
+ (gdb) handle SIGSEGV noprint nostop pass
110
+
111
+ The corresponding LLDB command is (after the process is started)::
112
+
113
+ (lldb) pro hand -p true -s false -n false SIGSEGV
114
+
115
+ If you are debugging a segfault with threaded code, you can set a breakpoint on
116
+ ``jl_critical_error `` (``sigdie_handler `` should also work on Linux and BSD) in
117
+ order to only catch the actual segfault rather than the GC synchronization points.
118
+
98
119
Debugging during julia's build process (bootstrap)
99
120
--------------------------------------------------
100
121
0 commit comments