#include "config.h"
#include "global.h"
-#include <pub_tool_threadstate.h>
-#include <pub_tool_libcfile.h>
+#include "pub_tool_threadstate.h"
+#include "pub_tool_libcfile.h"
/* Dump Part Counter */
* print_fn_pos, fprint_apos, fprint_fcost, fprint_jcc,
* fprint_fcc_ln, dump_run_info, dump_state_info
*/
-static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN];
+static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN];
Int CLG_(get_dump_counter)(void)
{
{
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);
}
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) {
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));
return;
}
- CLG_ASSERT(jcc->to !=0);
-
file = jcc->to->cxt->fn[0]->file;
obj = jcc->to->bb->obj;
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 );
if (size < BUF_LEN) cmdbuf[size++] = argv[j];
}
- if (size == BUF_LEN) size--;
+ if (size >= BUF_LEN) size = BUF_LEN-1;
cmdbuf[size] = 0;
}