How dtrace work: dtrace_consume()

While doing a gdb of dtrace in Linux, I got the follwing stacktraces:

Breakpoint 156, dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2381
2381 dtrace_bufdesc_t *buf = &dtp->dt_buf;
(gdb) bt
#0 dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2381
#1 0x0000000000461ae7 in dtrace_work (dtp=0x134f0f0, fp=0x7f58983b0260, pfunc=0x406ec7 <chew>, rfunc=0x406e54 <chewrec>, arg=0x0) at dt_work.c:294
#2 0x00000000004097ae in main (argc=3, argv=0x7fff045e9f68) at dtrace.c:1942
(gdb) cont
Continuing.

Breakpoint 159, dt_consume_begin (dtp=0x134f0f0, fp=0x7f58983b0260, buf=0x13513a8, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2261
2261 processorid_t cpu = dtp->dt_beganon;
(gdb) bt
#0 dt_consume_begin (dtp=0x134f0f0, fp=0x7f58983b0260, buf=0x13513a8, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2261
#1 0x0000000000427dda in dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2423
#2 0x0000000000461ae7 in dtrace_work (dtp=0x134f0f0, fp=0x7f58983b0260, pfunc=0x406ec7 <chew>, rfunc=0x406e54 <chewrec>, arg=0x0) at dt_work.c:294
#3 0x00000000004097ae in main (argc=3, argv=0x7fff045e9f68) at dtrace.c:1942
(gdb) cont
Continuing.

Breakpoint 163, dt_consume_cpu (dtp=0x134f0f0, fp=0x7f58983b0260, cpu=0, buf=0x13513a8, efunc=0x427617 <dt_consume_begin_probe>,
rfunc=0x4276f9 <dt_consume_begin_record>, arg=0x7fff045e9a30) at dt_consume.c:1725
1725 size_t offs, start = buf->dtbd_oldest, end = buf->dtbd_size;
(gdb)
Continuing.
cont

Breakpoint 167, dt_flowindent (dtp=0x134f0f0, data=0x7fff045e98a0, last=0, buf=0x13513a8, offs=0) at dt_consume.c:384
384 dtrace_probedesc_t *pd = data->dtpda_pdesc, *npd;
(gdb) cont
Continuing.

Breakpoint 161, dt_consume_begin_probe (data=0x7fff045e98a0, arg=0x7fff045e9a30) at dt_consume.c:2185
2185 dt_begin_t *begin = (dt_begin_t *)arg;
(gdb) bt
#0 dt_consume_begin_probe (data=0x7fff045e98a0, arg=0x7fff045e9a30) at dt_consume.c:2185
#1 0x0000000000426807 in dt_consume_cpu (dtp=0x134f0f0, fp=0x7f58983b0260, cpu=0, buf=0x13513a8, efunc=0x427617 <dt_consume_begin_probe>,
rfunc=0x4276f9 <dt_consume_begin_record>, arg=0x7fff045e9a30) at dt_consume.c:1777
#2 0x00000000004279a2 in dt_consume_begin (dtp=0x134f0f0, fp=0x7f58983b0260, buf=0x13513a8, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2304
#3 0x0000000000427dda in dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2423
#4 0x0000000000461ae7 in dtrace_work (dtp=0x134f0f0, fp=0x7f58983b0260, pfunc=0x406ec7 <chew>, rfunc=0x406e54 <chewrec>, arg=0x0) at dt_work.c:294
#5 0x00000000004097ae in main (argc=3, argv=0x7fff045e9f68) at dtrace.c:1942
(gdb) cont
Continuing.

Breakpoint 167, dt_flowindent (dtp=0x134f0f0, data=0x7fff045e98a0, last=645, buf=0x13513a8, offs=16) at dt_consume.c:384
384 dtrace_probedesc_t *pd = data->dtpda_pdesc, *npd;
(gdb) bt
#0 dt_flowindent (dtp=0x134f0f0, data=0x7fff045e98a0, last=645, buf=0x13513a8, offs=16) at dt_consume.c:384
#1 0x00000000004267f0 in dt_consume_cpu (dtp=0x134f0f0, fp=0x7f58983b0260, cpu=0, buf=0x13513a8, efunc=0x427617 <dt_consume_begin_probe>,
rfunc=0x4276f9 <dt_consume_begin_record>, arg=0x7fff045e9a30) at dt_consume.c:1775
#2 0x00000000004279a2 in dt_consume_begin (dtp=0x134f0f0, fp=0x7f58983b0260, buf=0x13513a8, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2304
#3 0x0000000000427dda in dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2423
#4 0x0000000000461ae7 in dtrace_work (dtp=0x134f0f0, fp=0x7f58983b0260, pfunc=0x406ec7 <chew>, rfunc=0x406e54 <chewrec>, arg=0x0) at dt_work.c:294
#5 0x00000000004097ae in main (argc=3, argv=0x7fff045e9f68) at dtrace.c:1942
(gdb) cont
Continuing.

Breakpoint 161, dt_consume_begin_probe (data=0x7fff045e98a0, arg=0x7fff045e9a30) at dt_consume.c:2185
2185 dt_begin_t *begin = (dt_begin_t *)arg;
(gdb) bt
#0 dt_consume_begin_probe (data=0x7fff045e98a0, arg=0x7fff045e9a30) at dt_consume.c:2185
#1 0x0000000000426807 in dt_consume_cpu (dtp=0x134f0f0, fp=0x7f58983b0260, cpu=0, buf=0x13513a8, efunc=0x427617 <dt_consume_begin_probe>,
rfunc=0x4276f9 <dt_consume_begin_record>, arg=0x7fff045e9a30) at dt_consume.c:1777
#2 0x00000000004279a2 in dt_consume_begin (dtp=0x134f0f0, fp=0x7f58983b0260, buf=0x13513a8, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2304
#3 0x0000000000427dda in dtrace_consume (dtp=0x134f0f0, fp=0x7f58983b0260, pf=0x406ec7 <chew>, rf=0x406e54 <chewrec>, arg=0x0) at dt_consume.c:2423
co#4 0x0000000000461ae7 in dtrace_work (dtp=0x134f0f0, fp=0x7f58983b0260, pfunc=0x406ec7 <chew>, rfunc=0x406e54 <chewrec>, arg=0x0) at dt_work.c:294
nt#5 0x00000000004097ae in main (argc=3, argv=0x7fff045e9f68) at dtrace.c:1942
(gdb) cont
Continuing.

Breakpoint 167, dt_flowindent (dtp=0x134f0f0, data=0x7fff045e98a0, last=13289, buf=0x13513a8, offs=20) at dt_consume.c:384
384 dtrace_probedesc_t *pd = data->dtpda_pdesc, *npd;

So it seemed dtrace_consume() is a central starting function here above.

Starting with dtrace in different OS:

https://hg.openindiana.org/upstream/illumos/illumos-gate/file/15b74a2a9a9d/usr/src/lib/libdtrace/common/dt_consume.c

http://www.opensource.apple.com/source/dtrace/dtrace-78/libdtrace/dt_consume.c

ftp://ftp8.freebsd.org/pub/FreeBSD/FreeBSD-current/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c

(http://code.google.com/p/freebsd-head/source/browse/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c?spec=svnc45cc9f30720abe6215fde3575fb053d92bc3561&r=c45cc9f30720abe6215fde3575fb053d92bc3561)

And searching the net:

http://www.nohuddleoffense.de/page/3/

and summarized here:

http://developers.sun.com/solaris/articles/java_on_solaris.html

And this is about using dtrace to understand MySQL internal:

http://dev.mysql.com/tech-resources/articles/getting_started_dtrace_saha.html

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: