~ubuntu-branches/ubuntu/lucid/erlang/lucid-proposed

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_process_dump.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-06-11 12:18:07 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090611121807-ks7eb4xrt7dsysgx
Tags: 1:13.b.1-dfsg-1
* New upstream release.
* Removed unnecessary dependency of erlang-os-mon on erlang-observer and
  erlang-tools and added missing dependency of erlang-nox on erlang-os-mon
  (closes: #529512).
* Removed a patch to eunit application because the bug was fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "dist.h"
32
32
#include "beam_catches.h"
33
33
#include "erl_binary.h"
 
34
#define ERTS_WANT_EXTERNAL_TAGS
 
35
#include "external.h"
34
36
 
35
37
#define WORD_FMT "%X"
36
38
#define ADDR_FMT "%X"
39
41
 
40
42
static void dump_process_info(int to, void *to_arg, Process *p);
41
43
static void dump_element(int to, void *to_arg, Eterm x);
 
44
static void dump_dist_ext(int to, void *to_arg, ErtsDistExternal *edep);
42
45
static void dump_element_nl(int to, void *to_arg, Eterm x);
43
46
static int stack_element_dump(int to, void *to_arg, Process* p, Eterm* sp,
44
47
                              int yreg);
89
92
        erts_print(to, to_arg, "=proc_messages:%T\n", p->id);
90
93
        for (mp = p->msg.first; mp != NULL; mp = mp->next) {
91
94
            Eterm mesg = ERL_MESSAGE_TERM(mp);
92
 
            dump_element(to, to_arg, mesg);
 
95
            if (is_value(mesg))
 
96
                dump_element(to, to_arg, mesg);
 
97
            else
 
98
                dump_dist_ext(to, to_arg, mp->data.dist_ext);
93
99
            mesg = ERL_MESSAGE_TOKEN(mp);
94
100
            erts_print(to, to_arg, ":");
95
101
            dump_element(to, to_arg, mesg);
121
127
        }
122
128
        for (mp = p->msg.first; mp != NULL; mp = mp->next) {
123
129
            Eterm mesg = ERL_MESSAGE_TERM(mp);
124
 
            heap_dump(to, to_arg, mesg);
 
130
            if (is_value(mesg))
 
131
                heap_dump(to, to_arg, mesg);
125
132
            mesg = ERL_MESSAGE_TOKEN(mp);
126
133
            heap_dump(to, to_arg, mesg);
127
134
        }
132
139
}
133
140
 
134
141
static void
 
142
dump_dist_ext(int to, void *to_arg, ErtsDistExternal *edep)
 
143
{
 
144
    if (!edep)
 
145
        erts_print(to, to_arg, "D0:E0:");
 
146
    else {
 
147
        byte *e;
 
148
        size_t sz;
 
149
        if (!(edep->flags & ERTS_DIST_EXT_ATOM_TRANS_TAB))
 
150
            erts_print(to, to_arg, "D0:");
 
151
        else {
 
152
            int i;
 
153
            erts_print(to, to_arg, "D%X:", edep->attab.size);
 
154
            for (i = 0; i < edep->attab.size; i++)
 
155
                dump_element(to, to_arg, edep->attab.atom[i]);
 
156
        }
 
157
        sz = edep->ext_endp - edep->extp;
 
158
        e = edep->extp;
 
159
        if (edep->flags & ERTS_DIST_EXT_DFLAG_HDR) {
 
160
            ASSERT(*e != VERSION_MAGIC);
 
161
            sz++;
 
162
        }
 
163
        else {
 
164
            ASSERT(*e == VERSION_MAGIC);
 
165
        }
 
166
 
 
167
        erts_print(to, to_arg, "E%X:", sz);
 
168
        if (edep->flags & ERTS_DIST_EXT_DFLAG_HDR)
 
169
            erts_print(to, to_arg, "%02X", VERSION_MAGIC);
 
170
        while (e < edep->ext_endp)
 
171
            erts_print(to, to_arg, "%02X", *e++);
 
172
    }
 
173
}
 
174
 
 
175
static void
135
176
dump_element(int to, void *to_arg, Eterm x)
136
177
{
137
178
    if (is_list(x)) {
405
446
    }
406
447
 
407
448
    s = p = sbuf;
408
 
    erts_to_external_format(NULL, term, &p, NULL, NULL);
 
449
    erts_encode_ext(term, &p);
409
450
    erts_print(to, to_arg, "E%X:", p-s);
410
451
    while (s < p) {
411
452
        erts_print(to, to_arg, "%02X", *s++);