|
From: <sv...@va...> - 2015-12-06 22:11:29
|
Author: philippe
Date: Sun Dec 6 22:11:21 2015
New Revision: 15744
Log:
addLoc: only merge the new entry with the previous one if the resulting
size does not exceed the max allowed.
Also improve the tracing.
Modified:
trunk/coregrind/m_debuginfo/storage.c
Modified: trunk/coregrind/m_debuginfo/storage.c
==============================================================================
--- trunk/coregrind/m_debuginfo/storage.c (original)
+++ trunk/coregrind/m_debuginfo/storage.c Sun Dec 6 22:11:21 2015
@@ -412,6 +412,18 @@
}
}
+
+// Comment the below line to trace LOCTAB merging/canonicalising
+#define TRACE_LOCTAB_CANON(msg,prev_loc,cur_loc)
+#ifndef TRACE_LOCTAB_CANON
+#define TRACE_LOCTAB_CANON(msg,prev_loc,cur_loc) \
+ VG_(printf)("%s previous: addr %#lx, size %d, line %d, " \
+ " current: addr %#lx, size %d, line %d.\n", \
+ msg, \
+ (prev_loc)->addr, (prev_loc)->size, (prev_loc)->lineno, \
+ (cur_loc)->addr, (cur_loc)->size, (cur_loc)->lineno);
+#endif
+
/* Add a location to the location table.
*/
static void addLoc ( struct _DebugInfo* di, DiLoc* loc, UInt fndn_ix )
@@ -424,13 +436,14 @@
DiLoc *previous = &di->loctab[di->loctab_used - 1];
if ((previous->lineno == loc->lineno)
&& (previous->addr + previous->size == loc->addr)) {
- if (0)
- VG_(printf)("Merging previous: addr %#lx, size %d, line %d, "
- "with current: addr %#lx, size %d, line %d.\n",
- previous->addr, previous->size, previous->lineno,
- loc->addr, loc->size, loc->lineno);
- previous->size += loc->size;
- return;
+ if (previous->size + loc->size <= MAX_LOC_SIZE) {
+ TRACE_LOCTAB_CANON ("addLoc merging", previous, loc);
+ previous->size += loc->size;
+ return;
+ } else {
+ TRACE_LOCTAB_CANON ("addLoc merging not done (maxsize)",
+ previous, loc);
+ }
}
}
@@ -2016,13 +2029,15 @@
/* sort loctab and loctab_fndn_ix by addr. */
sort_loctab_and_loctab_fndn_ix (di);
- /* If two adjacent entries overlap, truncate the first. */
for (i = 0; i < ((Word)di->loctab_used)-1; i++) {
vg_assert(di->loctab[i].size < 10000);
+ /* If two adjacent entries overlap, truncate the first. */
if (di->loctab[i].addr + di->loctab[i].size > di->loctab[i+1].addr) {
/* Do this in signed int32 because the actual .size fields
are only 12 bits. */
Int new_size = di->loctab[i+1].addr - di->loctab[i].addr;
+ TRACE_LOCTAB_CANON ("Truncating",
+ &(di->loctab[i]), &(di->loctab[i+1]));
if (new_size < 0) {
di->loctab[i].size = 0;
} else
|