aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc
diff options
context:
space:
mode:
Diffstat (limited to 'erts/etc')
-rw-r--r--erts/etc/common/erlexec.c6
-rw-r--r--erts/etc/unix/cerl.src15
-rw-r--r--erts/etc/unix/etp-commands260
3 files changed, 212 insertions, 69 deletions
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index 04d3425fe0..50c61f50eb 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -127,6 +127,7 @@ static char *pluss_val_switches[] = {
"wt",
"ws",
"ss",
+ "pp",
NULL
};
/* +h arguments with values */
@@ -799,7 +800,9 @@ int main(int argc, char **argv)
case 'A':
case 'b':
case 'i':
+ case 'n':
case 'P':
+ case 'Q':
case 'S':
case 't':
case 'T':
@@ -1103,7 +1106,8 @@ usage_aux(void)
"[-make] [-man [manopts] MANPAGE] [-x] [-emu_args] "
"[-args_file FILENAME] [+A THREADS] [+a SIZE] [+B[c|d|i]] [+c] "
"[+h HEAP_SIZE_OPTION] [+K BOOLEAN] "
- "[+l] [+M<SUBSWITCH> <ARGUMENT>] [+P MAX_PROCS] [+R COMPAT_REL] "
+ "[+l] [+M<SUBSWITCH> <ARGUMENT>] [+P MAX_PROCS] [+Q MAX_PORTS] "
+ "[+R COMPAT_REL] "
"[+r] [+rg READER_GROUPS_LIMIT] [+s SCHEDULER_OPTION] "
"[+S NO_SCHEDULERS:NO_SCHEDULERS_ONLINE] [+T LEVEL] [+V] [+v] "
"[+W<i|w>] [+z MISC_OPTION] [args ...]\n");
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index 651452e531..cc7d77fd9a 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -304,10 +304,17 @@ else
;;
esac
- # Set annotation level for gdb in emacs 22 and higher.
- emacs_major=`$EMACS --version | head -1 | sed 's,^[^0-9]*\([0-9]*\).*,\1,g'`
- if [ '!' -z "$emacs_major" -a $emacs_major -gt 21 ]; then
- GDBARGS="--annotate=1 "
+ if [ "$EMACS_ANNOTATE_LEVEL" != "" ]; then
+ GDBARGS="--annotate=$EMACS_ANNOTATE_LEVEL"
+ else
+ # Set annotation level for gdb in emacs 22 and higher. Seems to
+ # be working with level 1 for emacs 22 and level 3 for emacs 23...
+ emacs_major=`$EMACS --version | head -1 | sed 's,^[^0-9]*\([0-9]*\).*,\1,g'`
+ if [ '!' -z "$emacs_major" -a $emacs_major -gt 22 ]; then
+ GDBARGS="--annotate=3 "
+ elif [ '!' -z "$emacs_major" -a $emacs_major -gt 21 ]; then
+ GDBARGS="--annotate=1 "
+ fi
fi
gdbcmd="$gdbcmd $GDBBP \
(insert-string \"source $ROOTDIR/erts/etc/unix/etp-commands\") \
diff --git a/erts/etc/unix/etp-commands b/erts/etc/unix/etp-commands
index d98505c0ff..f059662271 100644
--- a/erts/etc/unix/etp-commands
+++ b/erts/etc/unix/etp-commands
@@ -705,8 +705,6 @@ define etp-ct-name-1
end
end
-
-
define etp-pid-1
# Args: Eterm pid
#
@@ -714,9 +712,17 @@ define etp-pid-1
#
set $etp_pid_1 = (Eterm)($arg0)
if ($etp_pid_1 & 0xF) == 0x3
+ if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_big_endian)
+ set $etp_pid_data = (unsigned) ((((Uint64) $etp_pid_1) >> 36) & 0x0fffffff)
+ else
+ set $etp_pid_data = (unsigned) ((((Uint64) $etp_pid_1) >> 4) & 0x0fffffff)
+ end
+ else
+ set $etp_pid_data = (unsigned) (((((Uint32) $etp_pid_1) >> 4) & ~erts_proc.r.o.pix_mask) | ((((Uint32) $etp_pid_1) >> (erts_proc.r.o.pix_cl_shift + 4)) & erts_proc.r.o.pix_cl_mask) | (((((Uint32) $etp_pid_1) >> 4) & erts_proc.r.o.pix_cli_mask) << erts_proc.r.o.pix_cli_shift))
+ end
# Internal pid
- printf "<0.%u.%u>", (unsigned) ($etp_pid_1>>4)&0x7fff, \
- (unsigned) ($etp_pid_1>>19)&0x1fff
+ printf "<0.%u.%u>", $etp_pid_data & 0x7fff, ($etp_pid_data >> 15) & 0x1fff
else
printf "#NotPid<%#x>", ($arg0)
end
@@ -759,7 +765,6 @@ define etp-extpid-1
end
-
define etp-port-1
# Args: Eterm port
#
@@ -767,8 +772,17 @@ define etp-port-1
#
set $etp_port_1 = (Eterm)($arg0)
if ($etp_port_1 & 0xF) == 0x7
+ if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_big_endian)
+ set $etp_port_data = (unsigned) ((((Uint64) $etp_port_1) >> 36) & 0x0fffffff)
+ else
+ set $etp_port_data = (unsigned) ((((Uint64) $etp_port_1) >> 4) & 0x0fffffff)
+ end
+ else
+ set $etp_port_data = (unsigned) (((((Uint32) $etp_port_1) >> 4) & ~erts_port.r.o.pix_mask) | ((((Uint32) $etp_port_1) >> (erts_port.r.o.pix_cl_shift + 4)) & erts_port.r.o.pix_cl_mask) | (((((Uint32) $etp_port_1) >> 4) & erts_port.r.o.pix_cli_mask) << erts_port.r.o.pix_cli_shift))
+ end
# Internal port
- printf "#Port<0.%u>", (unsigned) ($etp_port_1>>4)&0x3ffff
+ printf "#Port<0.%u>", $etp_port_data
else
printf "#NotPort<%#x>", ($arg0)
end
@@ -1264,23 +1278,32 @@ document etpf-stackdump
%---------------------------------------------------------------------------
end
+define etp-pid2pix-1
+# Args: Eterm
+#
+ if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_big_endian)
+ set $etp_pix = (int) (((Uint64) $arg0) & 0x0fffffff)
+ else
+ set $etp_pix = (int) ((((Uint64) $arg0) >> 32) & 0x0fffffff)
+ end
+ else
+ set $etp_pix = (int) ((((Uint32) $arg0) >> 4) & erts_proc.r.o.pix_mask)
+ end
+end
+
define etp-pix2proc
# Args: Eterm
#
- set $proc = (Process *) *((UWord *) &erts_proc.tab[((int) $arg0)])
+ set $proc = (Process *) *((UWord *) &erts_proc.r.o.tab[((int) $arg0)])
printf "(Process *) %p\n", $proc
end
define etp-pid2proc-1
# Args: Eterm
#
- set $pix = (int) ($arg0 >> 4)
-
- if (erts_proc.pix_cl_mask != 0)
- set $proc = (Process *) *((UWord *) &erts_proc.tab[(((($pix) & erts_proc.pix_cl_mask) << erts_proc.pix_cl_shift) + ((($pix) >> erts_proc.pix_cli_shift) & erts_proc.pix_cli_mask))])
- else
- set $proc =(Process *) *((UWord *) &erts_proc.tab[((($pix) % erts_proc.max) % erts_proc.tab_cache_lines + (($pix) % erts_proc.max) / erts_proc.tab_cache_lines)])
- end
+ etp-pid2pix-1 $arg0
+ set $proc = (Process *) *((UWord *) &erts_proc.r.o.tab[$etp_pix])
end
define etp-pid2proc
@@ -1369,13 +1392,15 @@ define etp-process-info
# Args: Process*
#
printf " Pid: "
- etp-1 $arg0->id
+ etp-1 $arg0->common.id
printf "\n State: "
etp-proc-state $arg0
- if ($arg0->reg)
- printf " Registered name: "
- etp-1 $arg0->reg->name
- printf "\n"
+ if (*(((Uint32 *) &(((Process *) $arg0)->state))) & 0x4) == 0
+ if ($arg0->common.u.alive.reg)
+ printf " Registered name: "
+ etp-1 $arg0->common.u.alive.reg->name
+ printf "\n"
+ end
end
if ($arg0->current)
printf " Current function: "
@@ -1400,7 +1425,7 @@ define etp-process-info
end
printf " Mbuf size: %ld\n", $arg0->mbuf_sz
if (etp_smp_compiled)
- printf " Msgq len: %ld (inner=%ld, outer=%ld)\n", ($arg0->msg.len + $arg0->u.alive.msg_inq.len), $arg0->msg.len, $arg0->u.alive.msg_inq.len
+ printf " Msgq len: %ld (inner=%ld, outer=%ld)\n", ($arg0->msg.len + $arg0->msg_inq.len), $arg0->msg.len, $arg0->msg_inq.len
else
printf " Msgq len: %d\n", $arg0->msg.len
end
@@ -1422,9 +1447,9 @@ define etp-processes
printf "No processes, since system isn't initialized!\n"
else
set $proc_ix = 0
- while $proc_ix < erts_proc.max
- set $proc = (Process *) *((UWord *) &erts_proc.tab[$proc_ix])
- if ($proc != (Process *) 0)
+ while $proc_ix < erts_proc.r.o.max
+ set $proc = (Process *) *((UWord *) &erts_proc.r.o.tab[$proc_ix])
+ if ($proc != ((Process *) 0) && $proc != &erts_invalid_process)
printf "---\n"
printf " Pix: %d\n", $proc_ix
etp-process-info $proc
@@ -1443,8 +1468,108 @@ document etp-processes
%---------------------------------------------------------------------------
end
+define etp-port-id2pix-1
+# Args: Eterm
+#
+ if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_big_endian)
+ set $etp_pix = (int) (((Uint64) $arg0) & 0x0fffffff)
+ elser
+ set $etp_pix = (int) ((((Uint64) $arg0) >> 32) & 0x0fffffff)
+ end
+ else
+ set $etp_pix = (int) ((((Uint32) $arg0) >> 4) & erts_port.r.o.pix_mask)
+ end
+end
+
+define etp-pix2port
+# Args: Eterm
+#
+ set $port = (Port *) *((UWord *) &erts_port.r.o.tab[((int) $arg0)])
+ printf "(Port *) %p\n", $port
+end
-define etp-port-status-int
+define etp-id2port-1
+# Args: Eterm
+#
+ etp-port-id2pix-1 $arg0
+ set $port = (Port *) *((UWord *) &erts_port.r.o.tab[((int) $etp_pix)])
+end
+
+define etp-id2port
+# Args: Eterm
+#
+ etp-id2port-1 $arg0
+ printf "(Port *) %p\n", $port
+end
+
+define etp-port-sched-flags-int
+# Args: int
+#
+ if ($arg0 & 0x1)
+ printf " in-run-queue"
+ end
+ if ($arg0 & 0x2)
+ printf " executing"
+ end
+ if ($arg0 & 0x4)
+ printf " have-tasks"
+ end
+ if ($arg0 & 0x8)
+ printf " exited"
+ end
+ if ($arg0 & 0x10)
+ printf " busy-port"
+ end
+ if ($arg0 & 0x20)
+ printf " busy-port-q"
+ end
+ if ($arg0 & 0x40)
+ printf " chk-unset-busy-port-q"
+ end
+ if ($arg0 & 0x80)
+ printf " have-busy-tasks"
+ end
+ if ($arg0 & 0x100)
+ printf " have-nosuspend-tasks"
+ end
+ if ($arg0 & 0x200)
+ printf " parallelism"
+ end
+ if ($arg0 & 0x400)
+ printf " force-sched"
+ end
+ if ($arg0 & 0xfffff800)
+ printf " GARBAGE"
+ end
+ printf "\n"
+end
+
+document etp-port-sched-flags-int
+%---------------------------------------------------------------------------
+% etp-proc-sched-flags-int int
+%
+% Print port sched-flags
+%---------------------------------------------------------------------------
+end
+
+
+define etp-port-sched-flags
+# Args: Port*
+#
+ set $sched_flags_int = *(((Uint32 *) &(((Port *) $arg0)->sched.flags)))
+ etp-port-sched-flags-int $sched_flags_int
+end
+
+document etp-port-sched-flags
+%---------------------------------------------------------------------------
+% etp-proc-sched-flags-int Port *
+%
+% Print port sched-flags
+%---------------------------------------------------------------------------
+end
+
+define etp-port-state-int
# Args: int
#
if ($arg0 & 0x1)
@@ -1463,68 +1588,62 @@ define etp-port-status-int
printf " soft-eof"
end
if ($arg0 & 0x20)
- printf " port-busy"
+ printf " closing"
end
if ($arg0 & 0x40)
- printf " closing"
+ printf " send-closed"
end
if ($arg0 & 0x80)
- printf " send-closed"
+ printf " linebuf-io"
end
if ($arg0 & 0x100)
- printf " linebuf-io"
+ printf " free"
end
if ($arg0 & 0x200)
- printf " immortal"
+ printf " initializing"
end
if ($arg0 & 0x400)
- printf " free"
+ printf " port-specific-lock"
end
if ($arg0 & 0x800)
- printf " free-scheduled"
+ printf " invalid"
end
if ($arg0 & 0x1000)
- printf " initializing"
- end
- if ($arg0 & 0x2000)
- printf " port-specific-lock"
- end
- if ($arg0 & 0x4000)
- printf " invalid"
+ printf " halt"
end
if (etp_debug_compiled)
- if ($arg0 & 0x7fff8000)
+ if ($arg0 & 0x7fffe000)
printf " GARBAGE"
end
else
- if ($arg0 & 0xffff8000)
+ if ($arg0 & 0xffffe000)
printf " GARBAGE"
end
end
printf "\n"
end
-document etp-port-status-int
+document etp-port-state-int
%---------------------------------------------------------------------------
% etp-proc-state-int int
%
-% Print port status
+% Print port state
%---------------------------------------------------------------------------
end
-define etp-port-status
+define etp-port-state
# Args: Port*
#
- set $status_int = *(((Uint32 *) &(((Port *) $arg0)->status)))
- etp-port-status-int $status_int
+ set $state_int = *(((Uint32 *) &(((Port *) $arg0)->state)))
+ etp-port-state-int $state_int
end
-document etp-port-status
+document etp-port-state
%---------------------------------------------------------------------------
% etp-proc-state-int Port *
%
-% Print port status
+% Print port state
%---------------------------------------------------------------------------
end
@@ -1532,17 +1651,22 @@ define etp-port-info
# Args: Port*
#
printf " Port: "
- etp-1 $arg0->id
+ etp-1 $arg0->common.id
printf "\n Name: %s\n", $arg0->name
- printf " Status:"
- etp-port-status $arg0
- if ($arg0->reg)
- printf " Registered name: "
- etp-1 $arg0->reg->name
- printf "\n"
+ printf " State:"
+ etp-port-state $arg0
+ printf " Scheduler flags:"
+ etp-port-sched-flags $arg0
+ if (*(((Uint32 *) &(((Port *) $arg0)->state))) & 0x5C00) == 0
+ if ($arg0->common.u.alive.reg)
+ printf " Registered name: "
+ etp-1 $arg0->common.u.alive.reg->name
+ printf "\n"
+ end
end
printf " Connected: "
- etp-1 $arg0->connected
+ set $connected = *(((Eterm *) &(((Port *) $arg0)->connected)))
+ etp-1 $connected
printf "\n Pointer: (Port *) %p\n", $arg0
end
@@ -1560,13 +1684,15 @@ define etp-ports
printf "No ports, since system isn't initialized!\n"
else
set $port_ix = 0
- while $port_ix < erts_max_ports
- set $port = &erts_port[$port_ix]
- if ($port->status & 0x400) == 0
- # I.e, not free
- printf "---\n"
- printf " Pix: %d\n", $port_ix
- etp-port-info $port
+ while $port_ix < erts_port.r.o.max
+ set $port = (Port *) *((UWord *) &erts_port.r.o.tab[$port_ix])
+ if ($port != ((Port *) 0) && $port != &erts_invalid_port)
+ if (*(((Uint32 *) &(((Port *) $port)->state))) & 0x100) == 0
+ # I.e, not free
+ printf "---\n"
+ printf " Pix: %d\n", $port_ix
+ etp-port-info $port
+ end
end
set $port_ix++
end
@@ -1866,6 +1992,12 @@ define etp-system-info
printf "ERTS version: %s\n", etp_erts_version
printf "Compile date: %s\n", etp_compile_date
printf "Arch: %s\n", etp_arch
+ printf "Endianess: "
+ if (etp_big_endian)
+ printf "Big\n"
+ else
+ printf "Little\n"
+ end
printf "Word size: %d-bit\n", etp_arch_bits
printf "Halfword: "
if (etp_halfword)
@@ -2113,8 +2245,8 @@ define etp-search-heaps-1
end
set $etp_search_heaps_i = 0
set $etp_search_heaps_found = 0
- while $etp_search_heaps_i < erts_proc.max
- set $proc = (Process *) *((UWord *) &erts_proc.tab[$proc_ix])
+ while $etp_search_heaps_i < erts_proc.r.o.max
+ set $proc = (Process *) *((UWord *) &erts_proc.r.o.tab[$proc_ix])
if $proc
if ($proc->heap <= ($arg0)) && \
(($arg0) < $proc->hend)