|
From: <sv...@va...> - 2015-02-05 22:31:04
|
Author: philippe
Date: Thu Feb 5 22:30:57 2015
New Revision: 14911
Log:
Fix debug output of aspacemgr
The list of segnames was shown with a seq nr,
while each segment was referencing its segname with an offset.
The patch ensures that at all places, both the seq nr and the
offset is output
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
Modified: trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- trunk/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ trunk/coregrind/m_aspacemgr/aspacemgr-linux.c Thu Feb 5 22:30:57 2015
@@ -479,6 +479,22 @@
ML_(am_sprintf)(buf, fmt, len);
}
+/* Returns a sequence number for the fnIdx position in segnames.
+ Used in aspacemgr debug output to associate a segment with
+ the list of segments output at the beginning. */
+static Int fnIdx_seqnr(Int fnIdx)
+{
+ SizeT ix;
+ Int seqnr = -1;
+
+ for (ix = 0; ix < segnames_used; ix += VG_(strlen)(segnames + ix) + 1) {
+ seqnr++;
+ if (ix == fnIdx)
+ return seqnr;
+ }
+
+ return -1;
+}
/* Show full details of an NSegment */
@@ -496,14 +512,15 @@
VG_(debugLog)(
logLevel, "aspacem",
"%3d: %s %010llx-%010llx %s %c%c%c%c%c %s "
- "d=0x%03llx i=%-7lld o=%-7lld (%d) %s\n",
+ "d=0x%03llx i=%-7lld o=%-7lld (%d,%d) %s\n",
segNo, show_SegKind(seg->kind),
(ULong)seg->start, (ULong)seg->end, len_buf,
seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',
seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',
seg->isCH ? 'H' : '-',
show_ShrinkMode(seg->smode),
- seg->dev, seg->ino, seg->offset, seg->fnIdx,
+ seg->dev, seg->ino, seg->offset,
+ fnIdx_seqnr(seg->fnIdx), seg->fnIdx,
name
);
}
@@ -543,13 +560,14 @@
VG_(debugLog)(
logLevel, "aspacem",
"%3d: %s %010llx-%010llx %s %c%c%c%c%c d=0x%03llx "
- "i=%-7lld o=%-7lld (%d)\n",
+ "i=%-7lld o=%-7lld (%d,%d)\n",
segNo, show_SegKind(seg->kind),
(ULong)seg->start, (ULong)seg->end, len_buf,
seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-',
seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',
seg->isCH ? 'H' : '-',
- seg->dev, seg->ino, seg->offset, seg->fnIdx
+ seg->dev, seg->ino, seg->offset,
+ fnIdx_seqnr(seg->fnIdx), seg->fnIdx
);
break;
@@ -587,7 +605,7 @@
i = 0;
for (ix = 0; ix < segnames_used; ix += VG_(strlen)(segnames + ix) + 1) {
VG_(debugLog)(logLevel, "aspacem",
- "(%2d) %s\n", i++, segnames + ix);
+ "(%d,%lu) %s\n", i++, ix, segnames + ix);
}
for (i = 0; i < nsegments_used; i++)
show_nsegment( logLevel, i, &nsegments[i] );
|