<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Have you tried loading the erts gdb scripts?</div>should be found under "erts/etc/unix/etp-commands"</div><div>Then you can get stacktrace from process for example..</div><div dir="ltr"><br></div><div dir="ltr">(gdb) source <path to etp-commands></div><div dir="ltr">(gdb) set $p = (Process *)0x2b82431401d8</div><div>(gdb) etp-stacktrace $p</div><div><br></div><div>/Jonas</div><div><br></div><div><br></div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 7, 2019 at 5:59 PM Bekes, Andras G wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I am not entirely sure of what we're doing, but here is the output:<br>
<br>
(gdb) frame 0<br>
#0 process_main (x_reg_array=0x20002, f_reg_array=0x2) at x86_64-unknown-linux-gnu/opt/smp/beam_hot.h:5252<br>
5252 c_p->seq_trace_lastcnt = unsigned_val(SEQ_TRACE_TOKEN_SERIAL(c_p));<br>
(gdb) print x_reg_array<br>
$4 = (Eterm *) 0x20002<br>
(gdb) print *x_reg_array<br>
Cannot access memory at address 0x20002<br>
(gdb) print f_reg_array<br>
$5 = (FloatDef *) 0x2<br>
(gdb) print *f_reg_array<br>
Cannot access memory at address 0x2<br>
(gdb) print c_p<br>
$7 = <value optimized out><br>
(gdb) print *c_p<br>
value has been optimized out<br>
<br>
(gdb) frame 1<br>
#1 0x00000000004641a4 in sched_thread_func (vesdp=0x2b8244840200) at beam/erl_process.c:8465<br>
8465 process_main(esdp->x_reg_array, esdp->f_reg_array);<br>
(gdb) print esdp<br>
$8 = (ErtsSchedulerData *) 0x2b8244840200<br>
(gdb) print *esdp<br>
$9 = {x_reg_array = 0x2b823e940200, f_reg_array = 0x2b823e942240, timer_wheel = 0x2b82450f5c80,<br>
next_tmo_ref = 0x2b8245136120, timer_service = 0x2b8245176680, tid = 47838514915072, erl_bits_state = {<br>
byte_buf_ = 0x2b823ad81058 "", byte_buf_len_ = 1, erts_current_bin_ = 0x2b832e60c688 "\n\274\362T",<br>
erts_bin_offset_ = 32, erts_writable_bin_ = 0}, match_pseudo_process = 0x2b823bec7c78, free_process = 0x0,<br>
thr_progress_data = {id = 1, is_managed = 1, is_blocking = 0, is_temporary = 0, wakeup_request = {5707836, 5707869,<br>
5707862, 5707859}, leader = 0, active = 1, confirmed = 5707879, leader_state = {next = 5707875,<br>
current = 18446744073709551615, chk_next_ix = 2, umrefc_ix = {current = 0, waiting = -1}}}, ssi = 0x2b823be7e680,<br>
current_process = 0x2b82431401d8, type = ERTS_SCHED_NORMAL, no = 1, dirty_no = 0, flxctr_slot_no = 1,<br>
current_nif = 0x0, dirty_shadow_process = 0x0, current_port = 0x0, run_queue = 0x2b823be77ec0, virtual_reds = 0,<br>
cpu_id = -1, aux_work_data = {sched_id = 1, esdp = 0x2b8244840200, ssi = 0x2b823be7e680, current_thr_prgr = 5707878,<br>
latest_wakeup = 5707869, misc = {ix = 0, thr_prgr = 18446744073709551615}, dd = {thr_prgr = 5707869}, cncld_tmrs = {<br>
thr_prgr = 5707146}, later_op = {thr_prgr = 5707880, size = 65384, first = 0x2b832e8d76c8,<br>
last = 0x2b832e8d76c8}, async_ready = {need_thr_prgr = 0, thr_prgr = 18446744073709551615,<br>
queue = 0x2b8245059880}, delayed_wakeup = {next = 18446744073709551615, sched2jix = 0x2b82443650c8, jix = -1,<br>
job = 0x2b8244364f00}, yield = {alcu_blockscan = {current = 0x0, last = 0x0}, ets_all = {ongoing = 0x0,<br>
hfrag = 0x0, tab = 0x0, queue = 0x0}}, debug = {wait_completed = {flags = 0, callback = 0, arg = 0x0}}},<br>
atom_cache_map = {hdr_sz = -1, sz = 0, long_atoms = 0, cix = {0 <repeats 2048 times>}, cache = {{atom = 0,<br>
iix = -1} <repeats 2048 times>}}, last_monotonic_time = 54631431230926, check_time_reds = 3137, thr_id = 1,<br>
unique = 251, ref = 1016430404454740281, alloc_data = {deallctr = {0x0, 0x0, 0x0, 0x2b81f77a9200, 0x2b823ad37200,<br>
0x2b823bdaa200, 0x2b823e8d5200, 0x2b8240f13200, 0x2b8242ff9200, 0x0, 0x0, 0x2b823fea0200, 0x2b8241f86200, 0x0},<br>
pref_ix = {0, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1}, flist_ix = {0 <repeats 14 times>}, pre_alc_ix = 0}, io = {<br>
out = 21255996115, in = 21476723837}, pending_signal = {sig = 0x0, to = 0}, reductions = 1006796378,<br>
sched_wall_time = {u = {mod = {counter = 0}, need = 0}, enabled = 0, start = 0, working = {total = 0, start = 0}},<br>
gc_info = {reclaimed = 775481964, garbage_cols = 680476}, nosuspend_port_task_handle = {counter = 0}, ets_tables = {<br>
count = {counter = 0}, clist = 0x0}}<br>
(gdb) print esdp->x_reg_array<br>
$10 = (Eterm *) 0x2b823e940200<br>
(gdb) print *esdp->x_reg_array<br>
$11 = 2522015978211937347<br>
(gdb) print esdp->f_reg_array<br>
$12 = (FloatDef *) 0x2b823e942240<br>
(gdb) print *esdp->f_reg_array<br>
$13 = {fd = 0.002545, fb = "\323\023\226x@\331d?", fs = {5075, 30870, 55616, 16228}, fw = {2023101395, 1063573824},<br>
fdw = 4568014792984761299}<br>
<br>
frame 2 is in already in pthread/ethread.c<br>
<br>
<br>
-----Original Message-----<br>
From: erlang-questions [mailto:<a href="mailto:erlang-questions-bounces@erlang.org" target="_blank">erlang-questions-bounces@erlang.org</a>] On Behalf Of Eckard Brauer<br>
Sent: Saturday, November 02, 2019 10:01 AM<br>
To: <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
Subject: Re: [erlang-questions] Segfault with Erlang R22<br>
<br>
It's a few years ago, but IIRC either "print *c_p" or "print<br>
*((Process*) c_p)". Problem would probably be that the processor<br>
already left the stack frame where c_p is valid.<br>
<br>
You can do "info stack" at this point and select the frame with "frame<br>
<#>" to try it again. If you're a little familiar with assembly<br>
language, you can even have a look at "disassemble <address>" or<br>
"disassemble function" to get an idea of where values are at what point<br>
in the instruction/processing flow - sometimes this helps too.<br>
<br>
I'd investigate starting with frame 2 here, as all frames below are<br>
already in libpthread.<br>
<br>
Hope that helps a bit...<br>
<br>
Eckard<br>
<br>
<br>
Am Fri, 1 Nov 2019 18:22:18 +0000<br>
schrieb "Bekes, Andras G" :<br>
<br>
> Program terminated with signal 11, Segmentation fault.<br>
> #0 process_main (x_reg_array=0x20002, f_reg_array=0x2) at<br>
> x86_64-unknown-linux-gnu/opt/smp/beam_hot.h:5252<br>
> <br>
> 5252 c_p->seq_trace_lastcnt =<br>
> unsigned_val(SEQ_TRACE_TOKEN_SERIAL(c_p)); Missing separate<br>
> debuginfos, use: debuginfo-install glibc-2.12-1.212.el6_10.3.x86_64<br>
> (gdb) bt<br>
> #0 process_main (x_reg_array=0x20002, f_reg_array=0x2) at<br>
> x86_64-unknown-linux-gnu/opt/smp/beam_hot.h:5252<br>
> #1 0x00000000004641a4 in sched_thread_func (vesdp=0x2b8244840200) at<br>
> beam/erl_process.c:8465<br>
> #2 0x000000000069262a in thr_wrapper (vtwd=<value optimized out>)<br>
> at pthread/ethread.c:118<br>
> #3 0x00002b81f80f7dd5 in _L_unlock_48 () from /lib64/libpthread.so.0<br>
> #4 0x00002b81f80f5eb3 in __find_thread_by_id () from<br>
> /lib64/libpthread.so.0<br>
> #5 0x0000000000000000 in ?? ()<br>
> (gdb)<br>
> <br>
> I am not sure how to " print the c_p parameter via its raw value<br>
> (print *(Process*)0x.....)". Where should I take the value 0x.....<br>
> from?<br>
> <br>
> -----Original Message-----<br>
> From: Mikael Pettersson [mailto:<a href="mailto:mikpelinux@gmail.com" target="_blank">mikpelinux@gmail.com</a>]<br>
> Sent: Thursday, October 24, 2019 7:10 PM<br>
> To: Bekes, Andras G (IST)<br>
> Cc: Erlang Questions<br>
> Subject: Re: [erlang-questions] Segfault with Erlang R22<br>
> <br>
> On Thu, Oct 24, 2019 at 4:57 PM Bekes, Andras G wrote:<br>
> [...] <br>
> <br>
> I'd try to get a backtrace (bt command in gdb) from the crashed<br>
> thread, then maybe print<br>
> the c_p parameter via its raw value (print *(Process*)0x.....) if gdb<br>
> insists that the value<br>
> is optimized out.<br>
> <br>
> /Mikael<br>
> <br>
> [...] <br>
> [...] <br>
> [...] <br>
> <br>
<br>
-- <br>
Wir haften nicht für die korrekte Funktion der in dieser eMail<br>
enthaltenen Viren. We are not liable for correct function of the<br>
viruses in this email! :)<br>
<br>