Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jun 2016 12:09:50 -0700
From:      Shrikanth Kamath <shrikanth07@gmail.com>
To:        freebsd-dtrace@freebsd.org
Subject:   Problem mapping multiple definitions of a structure coming from different modules
Message-ID:  <CAEOAkMX7DGzhGbQdLsPfU0fdp8oPHSQJ%2B71%2BbxdG1K=QDMJgkg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I have two drivers loaded if_igb.ko and if_em.ko on a machine and both
expose a different definition of struct tx_ring, so if we look at the
CTF sections of both drivers they have the individual  definitions of
struct tx_ring.

Now when we run  a dtrace probe I see the following error,

#dtrace -n 'fbt::igb_start_locked:entry { printf("%d\n", args[0]->num_desc); } '
dtrace: invalid probe specifier fbt::igb_start_locked:entry {
printf("%d\n", args[0]->num_desc); } : in action list: num_desc is not
a member of struct tx_ring

The problem is definition of struct tx_ring in if_igb.ko does contain
member num_desc but dtrace when it starts reads the symbols from
if_em.ko first and then from if_igb.ko, guess this is what is causing
dtrace to report that num_desc is not part of struct tx_ring.

The order in which it read the symbols from modules

...
libdtrace DEBUG: loaded if_em.ko [.SUNW_ctf] (17182 bytes)
libdtrace DEBUG: loaded if_em.ko [.symtab] (25704 bytes)
libdtrace DEBUG: loaded if_em.ko [.strtab] (25690 bytes)
libdtrace DEBUG: hashed if_em.ko [.symtab] (1058 symbols)
libdtrace DEBUG: sorted if_em.ko [.symtab] (880 symbols)
libdtrace DEBUG: loaded CTF container for if_em.ko (0xc56c80)
libdtrace DEBUG: loaded if_igb.ko [.SUNW_ctf] (17403 bytes)
libdtrace DEBUG: loaded if_igb.ko [.symtab] (22536 bytes)
libdtrace DEBUG: loaded if_igb.ko [.strtab] (22595 bytes)
libdtrace DEBUG: hashed if_igb.ko [.symtab] (926 symbols)
libdtrace DEBUG: sorted if_igb.ko [.symtab] (746 symbols)
...

Is there a way for dtrace to map the definition that we are asking to
the module probes that we use. To put plainly if my probe was from
if_igb then we should try to resolve struct tx_ring from if_igb first.
I am not very familiar but I guess dtrace is handicapped because of
the order in which linker passes these files to it. But yeah should
this be a genuine bug?

--
Shrikanth R K



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAEOAkMX7DGzhGbQdLsPfU0fdp8oPHSQJ%2B71%2BbxdG1K=QDMJgkg>