Hi All,
i need help wirth CTF
All worked well - i checked my older builds by gcc5 and i was able to see data
in:
echo "::spa" | mdb -k
but right now it is failed with:
root@dilos-t2:/export# echo "::spa" | mdb -k
ADDR STATE NAME
mdb: unexpected kind for type void () (member spa_name of type spa_t)
i have checked ctfdump on older and current builds:
ctfdump -dfhlsSt /kernel/fs/amd64/zfs | less
/struct spa
first lines:
[32809] struct spa (3168 bytes)
spa_name type=3430 off=0
spa_comment type=34 off=2048
we are interested in ’spa_name’ - it it is char [256] array.
spa_name has type=3430
looking this data in genunix:
ctfdump -dfhlsSt /kernel/amd64/genunix | less
/char [256]
[3430] char [256] contents: 5, index: 11
as we can see - we have found correct type with number [3430]
by ctfdump we can see - we have correct data in mdb zfs.so module and in
genunix.
loading mdb -k and try: ::spa and run siple dtrace script fro looking data we
can see:
mdb:
> ::spa
ADDR STATE NAME
mdb: unexpected kind for type void () (member spa_name of type spa_t)
dtrace script:
root@dilos-t2:/export# ./z.d -F -p 547
CPU FUNCTION
1 -> mdb_ctf_vread mdb_ctf_vread: target:spa_t,
mdb:mdb_spa_print_t
1 -> ctf_lookup_by_name ctf_lookup_by_name:
typenmae:mdb_spa_print_t
1 <- ctf_lookup_by_name ctf_lookup_by_name: ret:794
1 -> mdb_ctf_lookup_by_name mdb_ctf_lookup_by_name: name:spa_t
1 <- mdb_ctf_lookup_by_name mdb_ctf_lookup_by_name: ret:0
dtrace: error on enabled probe ID 6 (ID 62608: pid547:mdb:vread_helper:entry):
invalid address (0x3ff) in action #2 at DIF offset 12
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:6
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:6
1 -> mdb_ctf_member_iter mdb_ctf_member_iter: entry
1 -> mdb_ctf_member_iter mdb_ctf_member_iter: entry
1 -> vread_helper vread_helper: entry:member
spa_state of type spa_t
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:8
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:8
1 <- vread_helper vread_helper: ret:0
1 -> mdb_ctf_member_iter mdb_ctf_member_iter: entry
1 -> vread_helper vread_helper: entry:member
spa_name of type spa_t
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:4
1 <- mdb_ctf_type_kind mdb_ctf_type_kind: ret:5
1 <- vread_helper vread_helper: ret:4294967295
1 <- vread_helper vread_helper: ret:4294967295
we can see - we are failed at:
http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1325
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1325>
1321
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1321>
if (tgtkind
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#tgtkind>
== CTF_K_POINTER
<http://src.illumos.org/source/s?defs=CTF_K_POINTER&project=illumos-gate> &&
modkind
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#modkind>
== CTF_K_INTEGER
<http://src.illumos.org/source/s?defs=CTF_K_INTEGER&project=illumos-gate> &&
1322
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1322>
strcmp
<http://src.illumos.org/source/s?defs=strcmp&project=illumos-gate>(mdbtypename
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#mdbtypename>,
"uintptr_t") == 0) {
1323
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1323>
/* allow them to convert a pointer to a uintptr_t */
1324
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1324>
ASSERT
<http://src.illumos.org/source/s?defs=ASSERT&project=illumos-gate>(modsz
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#modsz>
== tgtsz
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#tgtsz>);
1325
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1325>
} else if (tgtkind
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#tgtkind>
!= modkind
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#modkind>)
{
1326
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1326>
mdb_ctf_warn
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#mdb_ctf_warn>(flags
<http://src.illumos.org/source/s?defs=flags&project=illumos-gate>, "unexpected
kind for type %s (%s)\n",
1327
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1327>
typename
<http://src.illumos.org/source/s?defs=typename&project=illumos-gate>, tgtname
<http://src.illumos.org/source/s?defs=tgtname&project=illumos-gate>);
1328
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1328>
return (set_errno
<http://src.illumos.org/source/s?defs=set_errno&project=illumos-gate>(EMDB_INCOMPAT
<http://src.illumos.org/source/s?defs=EMDB_INCOMPAT&project=illumos-gate>));
1329
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1329>
}
where tgtkind != modkind
we are failed here after :
http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1517
<http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_ctf.c#1517>
case CTF_K_ARRAY
we have incorrect tgtid for vread_helper.
question is - why it can be possible if we have correct CTF data in zfs.so
module & geuninx ?
another questoin is - how to fix it?
it is NOT issue with gcc5 build - i have tested build by gcc44 - the same issue.
also, i tried to load mdb tool to env with older build where it is working - it
still working.
also, i have tested CTF data by ctfdump - the same result on older build - i
can see data in the same scenarions with search.
more info - i’m using updated CTF tools from illumos-joyent tree a long time.
i;m using gcc44 build on SPARC - and it is woking with the same code base.
i have problems with CTF on Intel and i need your help.
best regards,
-Igor
------------------------------------------
openzfs-developer
Archives:
https://openzfs.topicbox.com/groups/developer/discussions/Tb703ee6ea19b8db9-M26f0378faaf286ab8aad18b0
Powered by Topicbox: https://topicbox.com