about summary refs log tree commit diff stats
path: root/subx/036global_variables.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-10 19:51:20 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-10 20:54:15 -0700
commit8950915a007f78c427f176609678c50ef9923e5b (patch)
treedbe10980201791f98d7ed02944c98d1defec38be /subx/036global_variables.cc
parent2a15acd51025c9a6e63865b6ba7b3fbbd4bdd802 (diff)
downloadmu-8950915a007f78c427f176609678c50ef9923e5b.tar.gz
4678
A debugging aid: 'subx --map translate' dumps a mapping from functions
to addresses to a file called "map", and 'subx --map run' loads the mapping
in "map", augmenting debug traces.

Let's see how much this helps. Debugging machine code has been pretty painful
lately.
Diffstat (limited to 'subx/036global_variables.cc')
-rw-r--r--subx/036global_variables.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/subx/036global_variables.cc b/subx/036global_variables.cc
index a5e15369..5281b545 100644
--- a/subx/036global_variables.cc
+++ b/subx/036global_variables.cc
@@ -47,8 +47,8 @@ void compute_addresses_for_global_variables(const segment& s, map<string, uint32
         if (trace_contains_errors()) return;
         if (j > 0)
           raise << "'" << to_string(inst) << "': global variable names can only be the first word in a line.\n" << end();
-        if (Dump_map)
-          cerr << "0x" << HEXWORD << current_address << ' ' << variable << '\n';
+        if (Map_file.is_open())
+          Map_file << "0x" << HEXWORD << current_address << ' ' << variable << '\n';
         put(address, variable, current_address);
         trace(99, "transform") << "global variable '" << variable << "' is at address 0x" << HEXWORD << current_address << end();
         // no modifying current_address; global variable definitions won't be in the final binary