symtab.cc (8229:78bf55f23338) | symtab.cc (10905:a6ca6831e775) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 94 unchanged lines hidden (view full) --- 103 } 104 105 file.close(); 106 107 return true; 108} 109 110void | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 94 unchanged lines hidden (view full) --- 103 } 104 105 file.close(); 106 107 return true; 108} 109 110void |
111SymbolTable::serialize(const string &base, ostream &os) | 111SymbolTable::serialize(const string &base, CheckpointOut &cp) const |
112{ | 112{ |
113 paramOut(os, base + ".size", addrTable.size()); | 113 paramOut(cp, base + ".size", addrTable.size()); |
114 115 int i = 0; 116 ATable::const_iterator p, end = addrTable.end(); 117 for (p = addrTable.begin(); p != end; ++p) { | 114 115 int i = 0; 116 ATable::const_iterator p, end = addrTable.end(); 117 for (p = addrTable.begin(); p != end; ++p) { |
118 paramOut(os, csprintf("%s.addr_%d", base, i), p->first); 119 paramOut(os, csprintf("%s.symbol_%d", base, i), p->second); | 118 paramOut(cp, csprintf("%s.addr_%d", base, i), p->first); 119 paramOut(cp, csprintf("%s.symbol_%d", base, i), p->second); |
120 ++i; 121 } 122} 123 124void | 120 ++i; 121 } 122} 123 124void |
125SymbolTable::unserialize(const string &base, Checkpoint *cp, 126 const string §ion) | 125SymbolTable::unserialize(const string &base, CheckpointIn &cp) |
127{ 128 clear(); 129 int size; | 126{ 127 clear(); 128 int size; |
130 paramIn(cp, section, base + ".size", size); | 129 paramIn(cp, base + ".size", size); |
131 for (int i = 0; i < size; ++i) { 132 Addr addr; 133 std::string symbol; 134 | 130 for (int i = 0; i < size; ++i) { 131 Addr addr; 132 std::string symbol; 133 |
135 paramIn(cp, section, csprintf("%s.addr_%d", base, i), addr); 136 paramIn(cp, section, csprintf("%s.symbol_%d", base, i), symbol); | 134 paramIn(cp, csprintf("%s.addr_%d", base, i), addr); 135 paramIn(cp, csprintf("%s.symbol_%d", base, i), symbol); |
137 insert(addr, symbol); 138 } 139} | 136 insert(addr, symbol); 137 } 138} |