@@ -1534,7 +1534,7 @@ void __dwarf_type_iter (CPUState *cpu, target_ulong base_addr, LocType loc_t,
15341534 return ;
15351535}
15361536
1537- const char * dwarf2_type_to_string (DwarfVarType *var_ty) {
1537+ const char * dwarf2_type_to_string (DwarfVarType *var_ty) {
15381538 std::string argname;
15391539 DwarfTypeInfo *ty = var_ty->type ;
15401540 std::string type_name = var_ty->nodename ;
@@ -1651,7 +1651,7 @@ void load_func_info(const char *dbg_prefix,
16511651 }
16521652 }
16531653 } else {
1654- printf (" [dwarf2] Could not find start of function [%s] in line number table something went wrong\n " , die_name.c_str ());
1654+ dprintf (" [dwarf2] Could not find start of function [%s] in line number table something went wrong\n " , die_name.c_str ());
16551655 }
16561656
16571657 // this is if we want the start of the function to be one PAST the line that represents start of function
@@ -1739,7 +1739,9 @@ void load_type_info(const char *dbg_prefix, const char *basename, uint64_t base_
17391739 case SugarType:
17401740 case PointerType:
17411741 {
1742- std::cout << (*ty) <<" \n " ;
1742+ if (debug) {
1743+ std::cout << (*ty) <<" \n " ;
1744+ }
17431745 type_map[basename][cu][off] = new RefTypeInfo (
17441746 tag, (*ty)[" name" ].asString (), sizeof (target_ulong),
17451747 (*ty)[" ref" ].asUInt64 (), basename, cu);
@@ -1815,7 +1817,6 @@ bool populate_line_range_list(const char *dbg_prefix, const char *basename, uint
18151817 lr[" lno" ].asUInt (), srcfn, lr[" func" ].asUInt64 (), lr[" col" ].asUInt ());
18161818 line_range_list.push_back (r);
18171819 }
1818-
18191820 if (debug) {
18201821 printf (" Line Range added to the list\n " );
18211822 std::cout << lr << " \n " ;
@@ -1828,7 +1829,6 @@ bool populate_line_range_list(const char *dbg_prefix, const char *basename, uint
18281829// Load all function and globar variable info
18291830bool load_debug_info (const char *dbg_prefix, const char *basename, uint64_t base_address, bool needs_reloc) {
18301831 populate_line_range_list (dbg_prefix, basename, base_address, needs_reloc);
1831- printf (" line_range_list.size() = %d\n " , (int ) line_range_list.size ());
18321832
18331833 load_func_info (dbg_prefix, basename, base_address, needs_reloc);
18341834 load_glob_vars (dbg_prefix, basename, base_address, needs_reloc);
@@ -1927,7 +1927,7 @@ bool main_exec_initialized = false;
19271927bool ensure_main_exec_initialized (CPUState *cpu) {
19281928 char fname[260 ] = {};
19291929 OsiProc * p = get_current_process (cpu);
1930- printf (" [ensure_main_exec_initialized] looking at libraries from the following program %s\n " , p->name );
1930+ dprintf (" [ensure_main_exec_initialized] looking at libraries from the following program %s\n " , p->name );
19311931 if (strncmp (p->name , proc_to_monitor, strlen (p->name )) != 0 ) {
19321932 dprintf (" [ensure_main_exec_initialized] Incorrect process to get mappings for: %s\n " , p->name );
19331933 return false ;
@@ -1954,21 +1954,21 @@ bool ensure_main_exec_initialized(CPUState *cpu) {
19541954 continue ;
19551955 }
19561956 strcpy (fname, bin_path.c_str ());
1957- printf (" [ensure_main_exec_initialized] Trying to load symbols for %s at 0x" TARGET_FMT_lx " .\n " , fname, m->base );
1958- printf (" [ensure_main_exec_initialized] access(%s, F_OK): %x\n " , fname, access (fname, F_OK));
1957+ dprintf (" [ensure_main_exec_initialized] Trying to load symbols for %s at 0x" TARGET_FMT_lx " .\n " , fname, m->base );
1958+ dprintf (" [ensure_main_exec_initialized] access(%s, F_OK): %x\n " , fname, access (fname, F_OK));
19591959 if (access (fname, F_OK) == -1 ) {
19601960 fprintf (stderr, " Couldn't open %s; will not load symbols for it.\n " , fname);
19611961 continue ;
19621962 }
19631963 active_libs.push_back (Lib (fname, m->base , m->base + m->size ));
19641964 uint64_t elf_base = elf_get_baseaddr (fname, m->name , m->base );
1965- printf (" [ensure_main_exec_initialized] Value of elf base address: 0x%lx\n " , (unsigned long ) elf_base);
1965+ dprintf (" [ensure_main_exec_initialized] Value of elf base address: 0x%lx\n " , (unsigned long ) elf_base);
19661966 bool needs_reloc = elf_base != m->base ;
19671967 if (!read_debug_info (fname, m->name , m->base , needs_reloc)) {
19681968 fprintf (stderr, " [ensure_main_exec_initialized] Couldn't load symbols from %s.\n " , fname);
19691969 continue ;
19701970 }
1971- printf (" [ensure_main_exec_initialized] SUCCESS\n " );
1971+ printf (" [ensure_main_exec_initialized] SUCCESS IN FINDING MAIN FUNCTION, LOADING DEBUG SYMBOLS \n " );
19721972 return true ;
19731973 }
19741974 return false ;
@@ -2451,7 +2451,7 @@ void handle_asid_change(CPUState *cpu, target_ulong asid, OsiProc *p) {
24512451 if (strncmp (p->name , proc_to_monitor, strlen (p->name )) == 0 ) {
24522452 target_ulong current_asid = panda_current_asid (cpu);
24532453 monitored_asid.insert (current_asid);
2454- printf (" monitoring asid " TARGET_FMT_lx " \n " , current_asid);
2454+ dprintf (" monitoring asid " TARGET_FMT_lx " \n " , current_asid);
24552455 }
24562456}
24572457// XXX: osi_foo is largetly commented out and basically does nothing
0 commit comments