History

Remove 'using namespace' statements from all but the execution table file.

arr committed 9 years ago

Commit 2519a931 parent 68d4d6931 files · +725 −426Browse files

Showing the changes to src/exec/debugger.cpp (1 of 31 files). Show all

Unified · Split

src/exec/debugger.cpp+52−24
@@ -18,8 +18,36 @@ · 17 unmodified lines
1818 #include <exceptions.h>
1919 #include "exec.h"
2020
21−using namespace disvm;
22−using namespace disvm::runtime;
21+using disvm::vm_t;
22+using disvm::loaded_vm_module_t;
23+using disvm::opcode_t;
24+
25+using disvm::runtime::type_descriptor_t;
26+using disvm::runtime::intrinsic_type_desc;
27+using disvm::runtime::word_t;
28+using disvm::runtime::pointer_t;
29+using disvm::runtime::module_id_t;
30+using disvm::runtime::runtime_flags_t;
31+using disvm::runtime::cookie_t;
32+using disvm::runtime::vm_pc_t;
33+using disvm::runtime::vm_registers_t;
34+using disvm::runtime::vm_module_t;
35+using disvm::runtime::vm_module_ref_t;
36+using disvm::runtime::vm_alloc_t;
37+using disvm::runtime::vm_string_t;
38+using disvm::runtime::vm_array_t;
39+using disvm::runtime::vm_list_t;
40+using disvm::runtime::vm_channel_t;
41+using disvm::runtime::vm_thread_state_t;
42+using disvm::runtime::vm_trap_flags_t;
43+using disvm::runtime::vm_term_request;
44+using disvm::runtime::vm_tool_controller_t;
45+using disvm::runtime::vm_event_t;
46+using disvm::runtime::vm_event_context_t;
47+
48+using disvm::symbol::function_name_format_t;
49+using disvm::symbol::advance_pc_t;
50+using disvm::symbol::symbol_data_t;
2351
2452 namespace
2553 {
@@ -146,7 +174,7 @@ namespace · 120 unmodified lines
146174 auto msg = std::stringstream{};
147175 walk_stack(r, [&msg, &dbg](const pointer_t, const vm_pc_t pc, const vm_module_ref_t &module_ref)
148176 {
149− auto func_maybe = dbg.resolve_to_function_source_line(module_ref.module->vm_id, pc, pc, symbol::function_name_format_t::name);
177+ auto func_maybe = dbg.resolve_to_function_source_line(module_ref.module->vm_id, pc, pc, function_name_format_t::name);
150178 if (!func_maybe.empty())
151179 {
152180 assert(func_maybe.size() == 1);
@@ -507,7 +535,7 @@ namespace · 354 unmodified lines
507535 {
508536 throw debug_cmd_error_t{ "Invalid module ID" };
509537 }
510− else if (util::has_flag(module->header.runtime_flag, runtime_flags_t::builtin))
538+ else if (disvm::util::has_flag(module->header.runtime_flag, runtime_flags_t::builtin))
511539 {
512540 throw debug_cmd_error_t{ "Unable to set breakpoint in built-in module" };
513541 }
@@ -569,7 +597,7 @@ namespace · 55 unmodified lines
569597 << std::setw(16) << details.module->module_name->str()
570598 << std::setw(0);
571599
572− auto func_maybe = cxt.dbg.resolve_to_function_source_line(details.module->vm_id, details.pc, details.pc, symbol::function_name_format_t::name);
600+ auto func_maybe = cxt.dbg.resolve_to_function_source_line(details.module->vm_id, details.pc, details.pc, function_name_format_t::name);
573601 if (!func_maybe.empty())
574602 {
575603 assert(func_maybe.size() == 1);
@@ -720,7 +748,7 @@ namespace · 144 unmodified lines
720748 end_pc = std::min(end_maybe, static_cast<int32_t>(code_section.size() - 1));
721749 }
722750
723− auto resolved_pc = dbg.resolve_to_function_source_line(r.module_ref->module->vm_id, begin_pc, end_pc, symbol::function_name_format_t::name);
751+ auto resolved_pc = dbg.resolve_to_function_source_line(r.module_ref->module->vm_id, begin_pc, end_pc, function_name_format_t::name);
724752 assert(resolved_pc.empty() || resolved_pc.size() == (end_pc - begin_pc + 1) && "Resolved PCs should have failed or match the PC count");
725753
726754 auto msg = std::stringstream{};
@@ -817,7 +845,7 @@ namespace · 90 unmodified lines
817845 auto value_is_pointer = bool{ false };
818846 const auto pointer_offset1 = byte_offset1 / pointer_size;
819847 auto value_to_examine = reinterpret_cast<pointer_t>(base_pointer[pointer_offset1]);
820− if (runtime::is_offset_pointer(*base_type, pointer_offset1))
848+ if (disvm::runtime::is_offset_pointer(*base_type, pointer_offset1))
821849 {
822850 value_is_pointer = true;
823851 auto alloc_to_examine = vm_alloc_t::from_allocation(value_to_examine);
@@ -835,7 +863,7 @@ namespace · 11 unmodified lines
835863
836864 const auto pointer_offset2 = byte_offset2 / pointer_size;
837865 value_to_examine = reinterpret_cast<pointer_t>(base_pointer[pointer_offset2]);
838− value_is_pointer = runtime::is_offset_pointer(*base_type, pointer_offset2);
866+ value_is_pointer = disvm::runtime::is_offset_pointer(*base_type, pointer_offset2);
839867 }
840868 }
841869
@@ -1022,7 +1050,7 @@ namespace · 180 unmodified lines
10221050
10231051 void execute_single_command(dbg_cmd_cxt_t &cxt, std::string cmd)
10241052 {
1025− const auto cmd_tokens = util::split(cmd);
1053+ const auto cmd_tokens = disvm::util::split(cmd);
10261054 if (cmd_tokens.empty())
10271055 return;
10281056
@@ -1081,9 +1109,9 @@ namespace · 52 unmodified lines
10811109
10821110 std::ostream& operator<<(std::ostream &ss, const debugger_options o)
10831111 {
1084− ss << "Break on enter: " << std::boolalpha << util::has_flag(o, debugger_options::break_on_enter) << "\n"
1085− << "Break on module load: " << std::boolalpha << util::has_flag(o, debugger_options::break_on_module_load) << "\n"
1086− << "Break on exception: " << std::boolalpha << util::has_flag(o, debugger_options::break_on_exception) << "\n";
1112+ ss << "Break on enter: " << std::boolalpha << disvm::util::has_flag(o, debugger_options::break_on_enter) << "\n"
1113+ << "Break on module load: " << std::boolalpha << disvm::util::has_flag(o, debugger_options::break_on_module_load) << "\n"
1114+ << "Break on exception: " << std::boolalpha << disvm::util::has_flag(o, debugger_options::break_on_exception) << "\n";
10871115
10881116 return ss;
10891117 }
@@ -1096,10 +1124,10 @@ debugger::debugger(const debugger_options opt) · 6 unmodified lines
10961124 { }
10971125
10981126 std::vector<std::string> debugger::resolve_to_function_source_line(
1099− disvm::runtime::module_id_t vm_id,
1127+ module_id_t vm_id,
11001128 vm_pc_t begin_pc,
11011129 vm_pc_t end_pc,
1102− symbol::function_name_format_t fmt) const
1130+ function_name_format_t fmt) const
11031131 {
11041132 auto iter = _vm_id_to_symbol_info.find(vm_id);
11051133 if (iter == std::cend(_vm_id_to_symbol_info))
@@ -1129,18 +1157,18 @@ std::vector<std::string> debugger::resolve_to_function_source_line( · 23 unmodified lines
11291157
11301158 resolved_functions_by_pc[next_pc - begin_pc] = std::move(ss.str());
11311159
1132− } while (d.try_advance_pc(symbol::advance_pc_t::next_debug_statement, &next_pc));
1160+ } while (d.try_advance_pc(advance_pc_t::next_debug_statement, &next_pc));
11331161
11341162 return resolved_functions_by_pc;
11351163 }
11361164
1137−std::vector<std::string> debugger::get_module_functions(disvm::runtime::module_id_t vm_id, const char *match) const
1165+std::vector<std::string> debugger::get_module_functions(module_id_t vm_id, const char *match) const
11381166 {
11391167 std::vector<std::string> funcs;
11401168 auto iter = _vm_id_to_symbol_info.find(vm_id);
11411169 if (iter != std::cend(_vm_id_to_symbol_info))
11421170 {
1143− auto f_infos = iter->second.data->get_functions(symbol::function_name_format_t::declaration);
1171+ auto f_infos = iter->second.data->get_functions(function_name_format_t::declaration);
11441172 for (auto &fi : f_infos)
11451173 {
11461174 // Only return functions that match the supplied string
@@ -1163,7 +1191,7 @@ std::vector<std::string> debugger::get_module_functions(disvm::runtime::module_i · 16 unmodified lines
11631191 return funcs;
11641192 }
11651193
1166−bool debugger::symbols_exist(disvm::runtime::module_id_t vm_id) const
1194+bool debugger::symbols_exist(module_id_t vm_id) const
11671195 {
11681196 return _vm_id_to_symbol_info.find(vm_id) != std::cend(_vm_id_to_symbol_info);
11691197 }
@@ -1220,7 +1248,7 @@ void debugger::on_load(vm_tool_controller_t &controller_, std::size_t tool_id) · 50 unmodified lines
12201248
12211249 debug_print_info(ss.str());
12221250
1223− if (util::has_flag(_options, debugger_options::break_on_exception))
1251+ if (disvm::util::has_flag(_options, debugger_options::break_on_exception))
12241252 prompt(*this, *cxt.value1.registers);
12251253 }));
12261254
@@ -1250,14 +1278,14 @@ void debugger::on_load(vm_tool_controller_t &controller_, std::size_t tool_id) · 23 unmodified lines
12501278 << m->module_name->str()
12511279 << " loaded";
12521280
1253− if (util::has_flag(m->header.runtime_flag, runtime_flags_t::builtin))
1281+ if (disvm::util::has_flag(m->header.runtime_flag, runtime_flags_t::builtin))
12541282 ss << " (built-in)";
12551283
12561284 debug_print_info(ss.str());
12571285
12581286 // If the break on enter flag was set, it will be true
12591287 // and the first module load will be the user entry module.
1260− if (util::has_flag(_options, debugger_options::break_on_enter))
1288+ if (disvm::util::has_flag(_options, debugger_options::break_on_enter))
12611289 {
12621290 // Reset the break on enter flag and set a breakpoint
12631291 // on the entry PC for the module - 'break on enter'
@@ -1265,7 +1293,7 @@ void debugger::on_load(vm_tool_controller_t &controller_, std::size_t tool_id) · 1 unmodified line
12651293 breakpoint_cookies.emplace(controller->set_breakpoint(m, m->header.entry_pc));
12661294 }
12671295
1268− if (util::has_flag(_options, debugger_options::break_on_module_load))
1296+ if (disvm::util::has_flag(_options, debugger_options::break_on_module_load))
12691297 prompt(*this, *cxt.value1.registers);
12701298 }));
12711299
@@ -1334,10 +1362,10 @@ void debugger::load_symbols(const disvm::loaded_vm_module_t &loaded_mod) · 62 unmodified lines
13341362 if (!sbl_file.is_open())
13351363 return;
13361364
1337− std::unique_ptr<symbol::symbol_data_t> symbol_data;
1365+ std::unique_ptr<symbol_data_t> symbol_data;
13381366 try
13391367 {
1340− symbol_data = symbol::read(sbl_file);
1368+ symbol_data = disvm::symbol::read(sbl_file);
13411369 }
13421370 catch (const std::runtime_error &e)
13431371 {