|
From: <sv...@va...> - 2011-05-11 12:28:09
|
Author: weidendo
Date: 2011-05-11 13:28:01 +0100 (Wed, 11 May 2011)
New Revision: 11742
Log:
Fix bugs catched by BEAM
Modified:
trunk/callgrind/dump.c
trunk/callgrind/sim.c
Modified: trunk/callgrind/dump.c
===================================================================
--- trunk/callgrind/dump.c 2011-05-11 12:01:37 UTC (rev 11741)
+++ trunk/callgrind/dump.c 2011-05-11 12:28:01 UTC (rev 11742)
@@ -336,6 +336,8 @@
{
Bool res = False;
+ CLG_ASSERT(bbcc && bbcc->cxt);
+
CLG_DEBUGIF(3) {
CLG_DEBUG(2, "+ print_fn_pos: ");
CLG_(print_cxt)(16, bbcc->cxt, bbcc->rec_index);
@@ -351,9 +353,9 @@
}
if (last->cxt != bbcc->cxt) {
- fn_node* last_from = (last->cxt && last->cxt->size>1) ?
+ fn_node* last_from = (last->cxt && last->cxt->size >1) ?
last->cxt->fn[1] : 0;
- fn_node* curr_from = (bbcc->cxt && bbcc->cxt->size>1) ?
+ fn_node* curr_from = (bbcc->cxt->size >1) ?
bbcc->cxt->fn[1] : 0;
if (curr_from == 0) {
if (last_from != 0) {
@@ -659,13 +661,15 @@
CLG_(print_jcc)(-10, jcc);
}
+ CLG_ASSERT(jcc->to !=0);
+ CLG_ASSERT(jcc->from !=0);
+
if (!get_debug_pos(jcc->to, bb_addr(jcc->to->bb), &target)) {
/* if we don't have debug info, don't switch to file "???" */
target.file = last->file;
}
- if (jcc->from &&
- (jcc->jmpkind == JmpCond || jcc->jmpkind == Ijk_Boring)) {
+ if ((jcc->jmpkind == JmpCond) || (jcc->jmpkind == Ijk_Boring)) {
/* this is a JCC for a followed conditional or boring jump. */
CLG_ASSERT(CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost));
@@ -720,8 +724,6 @@
return;
}
- CLG_ASSERT(jcc->to !=0);
-
file = jcc->to->cxt->fn[0]->file;
obj = jcc->to->bb->obj;
@@ -1635,15 +1637,19 @@
VG_(message)(Vg_DebugMsg, "Dumping done.\n");
}
-/* copy command to cmd buffer (could change) */
+/* Copy command to cmd buffer. We want to original command line
+ * (can change at runtime)
+ */
static
void init_cmdbuf(void)
{
Int i,j,size = 0;
HChar* argv;
- if (VG_(args_the_exename))
+ if (VG_(args_the_exename)) {
+ CLG_ASSERT( VG_(strlen)( VG_(args_the_exename) ) < BUF_LEN-1);
size = VG_(sprintf)(cmdbuf, " %s", VG_(args_the_exename));
+ }
for(i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
argv = * (HChar**) VG_(indexXA)( VG_(args_for_client), i );
@@ -1653,7 +1659,7 @@
if (size < BUF_LEN) cmdbuf[size++] = argv[j];
}
- if (size == BUF_LEN) size--;
+ if (size >= BUF_LEN) size = BUF_LEN-1;
cmdbuf[size] = 0;
}
Modified: trunk/callgrind/sim.c
===================================================================
--- trunk/callgrind/sim.c 2011-05-11 12:01:37 UTC (rev 11741)
+++ trunk/callgrind/sim.c 2011-05-11 12:28:01 UTC (rev 11742)
@@ -977,7 +977,7 @@
if (!CLG_(current_state).collect) return;
CLG_(bb_base) = 0;
- current_ii = ⅈ
+ current_ii = ⅈ /* needs to be set for update_XX_use */
CLG_(cost_base) = 0;
/* update usage counters */
@@ -995,6 +995,8 @@
for (i = 0; i < LL.sets * LL.assoc; i++)
if (LL.loaded[i].use_base)
update_LL_use(i, 0);
+
+ current_ii = 0;
}
|
|
From: Julian S. <js...@ac...> - 2011-05-11 15:29:21
|
On Wednesday, May 11, 2011, sv...@va... wrote: > Author: weidendo > Date: 2011-05-11 13:28:01 +0100 (Wed, 11 May 2011) > New Revision: 11742 > > Log: > Fix bugs catched by BEAM Excellent! Small q -- which of the reported bugs does this fix? J |
|
From: Josef W. <Jos...@gm...> - 2011-05-11 16:11:10
|
On Wednesday 11 May 2011, Julian Seward wrote: > On Wednesday, May 11, 2011, sv...@va... wrote: > > Author: weidendo > > Date: 2011-05-11 13:28:01 +0100 (Wed, 11 May 2011) > > New Revision: 11742 > > > > Log: > > Fix bugs catched by BEAM > > Excellent! Small q -- which of the reported bugs does this fix? Should fix all 4 bugs mentioned for Callgrind in Florians mail on "BEAM results for r11734". Josef > > J > |