Patch for lsblibchk
Thorsten Kukuk <[email protected]>
| Newsgroups | gmane.linux.lsb.test-suite |
|---|---|
| Organization | SuSE Linux Products GmbH, Nuernberg, Germany |
| Message-ID | <[email protected]> |
Hi,
with this patch, lsblibchk passes on x86. I don't know if the patch
is really correct, since I don't understand the whole lsblibchk code:
I found out, that classp->vtable[v].virtfuncs[j] is sometimes an empty
string, dladdr has to fail with it.
Thorsten
--- classchk.c 16 Jun 2005 18:58:20 -0000 1.46
+++ classchk.c 24 Jun 2005 07:01:07 -0000
@@ -222,8 +222,12 @@
* Look up the name of the symbol associated with the funcptr
* found in the vtable.
*/
+ if (classp->vtable[v].virtfuncs[j] == NULL || classp->vtable[v].virtfuncs[j][0] == '\0')
+ continue;
+
+ symp = dlsym(dlhndl, classp->vtable[v].virtfuncs[j]);
memset(&dlinfo,0,sizeof(dlinfo));
- if( !dladdr(fptr2ptr(vtvirtfuncs[j]), &dlinfo) ) {
+ if( !dladdr(symp, &dlinfo) ) {
fprintf(stderr,"Class %s\n", classp->name );
TETJ_REPORT_INFO("Error looking for symbol for Virtual table entry "
"[%d][%d](%p) expecting %s\n",
@@ -234,8 +238,8 @@
#ifdef DEBUG
if( classp->vtable[v].virtfuncs[j][0] ) {
- symp = dlsym(dlhndl, classp->vtable[v].virtfuncs[j]);
- if ( symp != fptr2ptr(vtvirtfuncs[j]) ) {
+ void *symp2 = dlsym(dlhndl, classp->vtable[v].virtfuncs[j]);
+ if ( symp2 != fptr2ptr(vtvirtfuncs[j]) ) {
Dl_info dlinfo2;
int s;
for(s=0;s<12;s++) {
@@ -244,13 +248,13 @@
fprintf(stderr,"vtable[%d] %p %s\n", s, vtvirtfuncs[s], dlinfo2.dli_sname );
}
memset(&dlinfo2,0,sizeof(dlinfo2));
- dladdr(symp, &dlinfo2);
+ dladdr(symp2, &dlinfo2);
fprintf(stderr,"Class %s\n", classp->name );
TETJ_REPORT_INFO("Symbol address for Virtual table entry "
"[%d][%d] %s is not expected\n", v, j,
classp->vtable[v].virtfuncs[j]);
fprintf(stderr,"%p doesn't match %p which appears to be %s %p\n",
- symp, fptr2ptr(vtvirtfuncs[j]), dlinfo2.dli_sname, dlinfo2.dli_saddr);
+ symp2, fptr2ptr(vtvirtfuncs[j]), dlinfo2.dli_sname, dlinfo2.dli_saddr);
test_failed = 1;
}
}
@@ -272,7 +276,7 @@
* for the funcptr that was used for the lookup.
*/
if( dlinfo.dli_saddr &&
- (fptr2ptr(*((fptr*)dlinfo.dli_saddr))!=fptr2ptr(vtvirtfuncs[j])) )
+ (dlinfo.dli_saddr!=fptr2ptr(symp)) )
{
if( (!libchk_debug&LIBCHK_DEBUG_CXXHUSH) ) {
printf("Uhoh2. Not an exact match %p %p\n",
@@ -283,7 +287,7 @@
fprintf(stderr,"Class %s\n", classp->name );
TETJ_REPORT_INFO("Symbol address found for Virtual table entry [%d][%d] "
"%p (found) doesn't match %p (expected).\n",
- v, j, dlinfo.dli_saddr, fptr2ptr(vtvirtfuncs[j]));
+ v, j, dlinfo.dli_saddr, fptr2ptr(symp));
test_failed = 1;
}
--
Thorsten Kukuk http://www.suse.de/~kukuk/ [email protected]
SUSE LINUX Products GmbH Maxfeldstr. 5 D-90409 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B