[dtrace-discuss] Where can I find the documentation about CTF?
陶捷 Tao Jie
eulertao at gmail.com
Wed Jul 25 01:24:25 PDT 2007
Dear, Mike and John:
Thank you for your help :)
Another problem ><
in ctf_types.c
int ctf_type_encoding(ctf_file_t *fp, ctf_id_t type, ctf_encoding_t *ep)
{
........
switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
case CTF_K_INTEGER:
data = *(const uint_t *)((uintptr_t)tp + increment);
........
}
tp is a variable of ctf_type_t
increment is set by ctf_get_ctt_size(), and its value should
be sizeof(ctf_type_t)
Am I right?
if so, (in a 32bit x86 architecuture)
------------------------------ <-- tp (pointer to the start of ctf_type_t)
| ctt_name |
------------------------------
| ctt_info | _u |
------------------------------
| ctt_lsizehi |
------------------------------
| ctt_lsizelo |
------------------------------ <-- tp+increment
| ???????? |
------------------------------
since the tp is casted to be an unsigned int, add increment to tp makes tp
point to the end of the ctf_type_t
and then cast it to a pointer to uint_t and dereference that address
I think the dereference value is ????????, anything that is not related with
the orignal tp, and it is very strange.
Is there anything wrong in my deduction?
Regards
TJ
2007/7/25, Michael Shapiro <mws at zion.eng.sun.com>:
>
>
> > > in ctf.h
> > > struct ctf_file {
> > > ctf_strs_t ctf_str[2]; /* array of string table base and bounds */
> > >
> > > Why do there exist two string tables?
> >
> > I could be wrong here, but I believe this is a size optimization that's
> not
> > actually used. The idea being that you could add CTF entries into a CTF
> > container that referred to an external string table (CTF_STRTAB_1)
> instead
> > of duplicating the string in the CTF container itself (CTF_STRTAB_0). I
> don't
> > think we actually do that anywhere in Solaris right now.
> >
> > regards
> > john
>
> Correct: I left space for that because many of the strings in the CTF data
> will match strings in the program symbol table (.symtab). Therefore I was
> leaving myself the option of adding another pass to CTF generation which
> could find such strings and leverage the fact that the object already had
> those strings in its ELF file and so we didn't need another copy of them.
> At some point someone can revisit how much of a benefit that would be.
>
> -Mike
>
> --
> Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070725/0f45f461/attachment-0001.html
More information about the dtrace-discuss
mailing list