[erlang-questions] Erlang C NIF access to process struct
Boshan Sun
sunboshan@REDACTED
Sun Nov 5 04:39:58 CET 2017
Hi all,
In Erlang, you can use `hipe_bifs:show_heap(self()).` to debug the
process's heap.
From: 0x000000001ee5c6e0 to 0x000000001ee5c748
| H E A P |
| Address | Contents |
|--------------------|--------------------|
4 | 0x000000001ee5c6e0 | 0x000000000000004f |
[] | 0x000000001ee5c6e8 | 0xfffffffffffffffb |
3 | 0x000000001ee5c6f0 | 0x000000000000003f |
[4] | 0x000000001ee5c6f8 | 0x000000001ee5c6e1 |
|--------------------|--------------------|
However the implementation is for 32-bits machine, and the table is kind of
off for a 64-bits erlang.
I want to write a C NIF to print similar heap information. What I need is
the address of `process -> heap` and the heap size so I can get the heap's
information.
My question is, is there a way to get a pointer to the given process via
pid in C NIF?
In NIF doc there's enif_get_local_pid
<http://erlang.org/doc/man/erl_nif.html#enif_get_local_pid> , how does this
pid translate to the process pointer?
Thanks!
Boshan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171104/00fba8a0/attachment.htm>
More information about the erlang-questions
mailing list