diff options
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r-- | erts/emulator/beam/beam_emu.c | 85 |
1 files changed, 15 insertions, 70 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index d0beccfda2..1dbe2cad00 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -41,8 +41,6 @@ #include "hipe_mode_switch.h" #include "hipe_bif1.h" #endif - -#include <assert.h> #include "dtrace-wrapper.h" /* #define HARDDEBUG 1 */ @@ -1053,72 +1051,6 @@ init_emulator(void) # define REG_tmp_arg2 #endif -ERTS_INLINE void -dtrace_proc_str(Process *process, char *process_buf) -{ - dtrace_pid_str(process->id, process_buf); -} - -ERTS_INLINE void -dtrace_pid_str(Eterm pid, char *process_buf) -{ - snprintf(process_buf, DTRACE_TERM_BUF_SIZE, "<%lu.%lu.%lu>", - pid_channel_no(pid), - pid_number(pid), - pid_serial(pid)); -} - -ERTS_INLINE void -dtrace_port_str(Port *port, char *port_buf) -{ - snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>", - port_channel_no(port->id), - port_number(port->id)); -} - -ERTS_INLINE void -dtrace_drvport_str(ErlDrvPort drvport, char *port_buf) -{ - Port *port = erts_drvport2port(drvport); - - snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>", - port_channel_no(port->id), - port_number(port->id)); -} - -ERTS_INLINE void -dtrace_fun_decode(Process *process, - Eterm module, Eterm function, int arity, - char *process_buf, char *mfa_buf) -{ - char funbuf[DTRACE_TERM_BUF_SIZE]; - char *funptr = funbuf; - char *p = NULL; - - if (process_buf) { - dtrace_proc_str(process, process_buf); - } - - erts_snprintf(funbuf, sizeof(funbuf), "%T", function); - /* - * I'm not quite sure how these function names are synthesized, - * but they almost always seem to be in the form of - * '-name/arity-fun-0-' so I'm chopping them up when it's -fun-0- - * (which seems to be the toplevel) - */ - if (funbuf[0] == '\'' && funbuf[1] == '-' - && strlen(funbuf) > 3 && funbuf[strlen(funbuf) - 3] == '0') { - p = strchr(funbuf, '/'); - if (p) { - *p = 0; - } - funptr += 2; - } - - erts_snprintf(mfa_buf, DTRACE_TERM_BUF_SIZE, "%T:%s/%d", - module, funptr, arity); -} - #ifdef HAVE_DTRACE #define DTRACE_CALL(p, m, f, a) \ @@ -1190,6 +1122,16 @@ dtrace_fun_decode(Process *process, #endif /* HAVE_DTRACE */ +void +dtrace_drvport_str(ErlDrvPort drvport, char *port_buf) +{ + Port *port = erts_drvport2port(drvport); + + erts_snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>", + port_channel_no(port->id), + port_number(port->id)); +} + /* * process_main() is called twice: * The first call performs some initialisation, including exporting @@ -1376,7 +1318,8 @@ void process_main(void) (Eterm)fptr[1], (Uint)fptr[2], NULL, fun_buf); } else { - snprintf(fun_buf, sizeof(fun_buf), "<unknown/%p>", next); + erts_snprintf(fun_buf, sizeof(fun_buf), + "<unknown/%p>", next); } } @@ -1970,7 +1913,9 @@ void process_main(void) if (DTRACE_ENABLED(message_receive)) { Eterm token2 = NIL; DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE); - Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0; + ERTS_DECLARE_DUMMY(Sint tok_label) = 0; + ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0; + ERTS_DECLARE_DUMMY(Sint tok_serial) = 0; dtrace_proc_str(c_p, receiver_name); token2 = SEQ_TRACE_TOKEN(c_p); |