removes the dependence of m_translate.c and m_libcassert.c on m_main.c.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3954
if ((i+1 == VG_(clo_dump_error))) {
StackTrace ips = VG_(extract_StackTrace)(p_min->where);
VG_(translate) ( 0 /* dummy ThreadId; irrelevant due to debugging*/,
- ips[0], /*debugging*/True, 0xFE/*verbosity*/);
+ ips[0], /*debugging*/True, 0xFE/*verbosity*/,
+ /*bbs_done*/0);
}
p_min->count = 1 << 30;
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
#include "pub_core_libcproc.h"
-#include "pub_core_main.h" // for VG_(bbs_done) -- stupid!
-#include "pub_core_options.h" // for VG_(bbs_done) -- stupid!
+#include "pub_core_options.h"
#include "pub_core_stacktrace.h"
#include "pub_core_syscall.h"
#include "pub_core_tooliface.h"
VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop);
VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH);
- VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done) );
+ // Don't print this, as it's not terribly interesting and avoids a
+ // dependence on m_scheduler/, which would be crazy.
+ //VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done) );
pp_sched_status();
VG_(printf)("\n");
static Char **vg_argv;
-/* ---------------------------------------------------------------------
- Running stuff
- ------------------------------------------------------------------ */
-
-/* 64-bit counter for the number of basic blocks done. */
-ULong VG_(bbs_done) = 0;
-
-
/*====================================================================*/
/*=== Counters, for profiling purposes only ===*/
/*====================================================================*/
{
// Translation stats
VG_(print_tt_tc_stats)();
- VG_(message)(Vg_DebugMsg,
- " dispatch: %llu jumps (bb entries).", VG_(bbs_done) );
// Scheduler stats
VG_(print_scheduler_stats)();
/* Counts downwards in VG_(run_innerloop). */
UInt VG_(dispatch_ctr);
+/* 64-bit counter for the number of basic blocks done. */
+static ULong bbs_done = 0;
+
/* Forwards */
static void do_client_request ( ThreadId tid );
static void scheduler_sanity ( ThreadId tid );
void VG_(print_scheduler_stats)(void)
{
VG_(message)(Vg_DebugMsg,
- " %d/%d major/minor sched events.",
+ "scheduler: %llu jumps (bb entries).", bbs_done );
+ VG_(message)(Vg_DebugMsg,
+ "scheduler: %d/%d major/minor sched events.",
n_scheduling_events_MAJOR, n_scheduling_events_MINOR);
}
done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 0;
vg_assert(done_this_time >= 0);
- VG_(bbs_done) += (ULong)done_this_time;
+ bbs_done += (ULong)done_this_time;
VGP_POPCC(VgpRun);
return trc;
found = VG_(search_transtab)( NULL, ip, True/*upd_fast_cache*/ );
if (!found) {
/* Not found; we need to request a translation. */
- if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/ )) {
+ if (VG_(translate)( tid, ip, /*debug*/False, 0/*not verbose*/, bbs_done )) {
found = VG_(search_transtab)( NULL, ip, True );
vg_assert2(found, "VG_TRC_INNER_FASTMISS: missing tt_fast entry");
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcprint.h"
-#include "pub_core_main.h" // for VG_(bbs_done)
#include "pub_core_options.h"
#include "pub_core_profile.h"
#include "pub_core_redir.h"
Bool VG_(translate) ( ThreadId tid,
Addr64 orig_addr,
Bool debugging_translation,
- Int debugging_verbosity )
+ Int debugging_verbosity,
+ ULong bbs_done )
{
Addr64 redir, orig_addr0 = orig_addr;
Int tmpbuf_used, verbosity;
Char fnname[64] = "";
VG_(get_fnname_w_offset)(orig_addr, fnname, 64);
VG_(printf)(
- "==== BB %d %s(0x%llx) approx BBs exec'd %lld ====\n",
+ "==== BB %d %s(0x%llx) BBs exec'd %lld ====\n",
VG_(get_bbs_translated)(), fnname, orig_addr,
- VG_(bbs_done));
+ bbs_done);
}
if (seg == NULL ||
score_cumul, buf_cumul,
score_here, buf_here, tops[r]->entry, name );
VG_(printf)("\n");
- VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags));
+ VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags), 0);
VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= end BB rank %d "
"=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r);
}
/* Something of a function looking for a home ... start up debugger. */
extern void VG_(start_debugger) ( ThreadId tid );
-/* 64-bit counter for the number of basic blocks done. */
-extern ULong VG_(bbs_done);
-
// Set up the libc freeres wrapper
extern void VG_(set_libc_freeres_wrapper_addr)(Addr);
Bool VG_(translate) ( ThreadId tid,
Addr64 orig_addr,
Bool debugging_translation,
- Int debugging_verbosity );
+ Int debugging_verbosity,
+ ULong bbs_done );
#endif // __PUB_CORE_TRANSLATE_H