@@ -334,8 +334,8 @@ struct LineState {
334334// to let us use contextual information (we may know we are looking up the end
335335// of an instruction).
336336struct AddrExprMap {
337- std::unordered_map<uint32_t , Expression*> startMap;
338- std::unordered_map<uint32_t , Expression*> endMap;
337+ std::unordered_map<BinaryLocation , Expression*> startMap;
338+ std::unordered_map<BinaryLocation , Expression*> endMap;
339339
340340 // Construct the map from the binaryLocations loaded from the wasm.
341341 AddrExprMap (const Module& wasm) {
@@ -353,15 +353,15 @@ struct AddrExprMap {
353353 }
354354 }
355355
356- Expression* getStart (uint32_t addr) const {
356+ Expression* getStart (BinaryLocation addr) const {
357357 auto iter = startMap.find (addr);
358358 if (iter != startMap.end ()) {
359359 return iter->second ;
360360 }
361361 return nullptr ;
362362 }
363363
364- Expression* getEnd (uint32_t addr) const {
364+ Expression* getEnd (BinaryLocation addr) const {
365365 auto iter = endMap.find (addr);
366366 if (iter != endMap.end ()) {
367367 return iter->second ;
@@ -382,7 +382,7 @@ struct AddrExprMap {
382382// map for the start and end addresses, since there is no chance of a function's
383383// start overlapping with another's end (there is the size LEB in the middle).
384384struct FuncAddrMap {
385- std::unordered_map<uint32_t , Function*> map;
385+ std::unordered_map<BinaryLocation , Function*> map;
386386
387387 // Construct the map from the binaryLocations loaded from the wasm.
388388 FuncAddrMap (const Module& wasm) {
@@ -392,7 +392,7 @@ struct FuncAddrMap {
392392 }
393393 }
394394
395- Function* get (uint32_t addr) const {
395+ Function* get (BinaryLocation addr) const {
396396 auto iter = map.find (addr);
397397 if (iter != map.end ()) {
398398 return iter->second ;
@@ -436,29 +436,29 @@ struct LocationUpdater {
436436 // Updates an expression's address. If there was never an instruction at that
437437 // address, or if there was but if that instruction no longer exists, return
438438 // 0. Otherwise, return the new updated location.
439- uint32_t getNewExprAddr (uint32_t oldAddr) const {
439+ BinaryLocation getNewExprAddr (BinaryLocation oldAddr) const {
440440 if (auto * expr = oldExprAddrMap.getStart (oldAddr)) {
441441 auto iter = newLocations.expressions .find (expr);
442442 if (iter != newLocations.expressions .end ()) {
443- uint32_t newAddr = iter->second .start ;
443+ BinaryLocation newAddr = iter->second .start ;
444444 return newAddr;
445445 }
446446 }
447447 return 0 ;
448448 }
449449
450- uint32_t getNewExprEndAddr (uint32_t oldAddr) const {
450+ BinaryLocation getNewExprEndAddr (BinaryLocation oldAddr) const {
451451 if (auto * expr = oldExprAddrMap.getEnd (oldAddr)) {
452452 auto iter = newLocations.expressions .find (expr);
453453 if (iter != newLocations.expressions .end ()) {
454- uint32_t newAddr = iter->second .end ;
454+ BinaryLocation newAddr = iter->second .end ;
455455 return newAddr;
456456 }
457457 }
458458 return 0 ;
459459 }
460460
461- uint32_t getNewFuncAddr (uint32_t oldAddr) const {
461+ BinaryLocation getNewFuncAddr (BinaryLocation oldAddr) const {
462462 if (auto * func = oldFuncAddrMap.get (oldAddr)) {
463463 // The function might have been optimized away, check.
464464 auto iter = newLocations.functions .find (func);
@@ -482,8 +482,8 @@ static void updateDebugLines(llvm::DWARFYAML::Data& data,
482482 // Parse the original opcodes and emit new ones.
483483 LineState state (table);
484484 // All the addresses we need to write out.
485- std::vector<uint32_t > newAddrs;
486- std::unordered_map<uint32_t , LineState> newAddrInfo;
485+ std::vector<BinaryLocation > newAddrs;
486+ std::unordered_map<BinaryLocation , LineState> newAddrInfo;
487487 // If the address was zeroed out, we must omit the entire range (we could
488488 // also leave it unchanged, so that the debugger ignores it based on the
489489 // initial zero; but it's easier and better to just not emit it at all).
@@ -523,7 +523,7 @@ static void updateDebugLines(llvm::DWARFYAML::Data& data,
523523 {
524524 std::vector<llvm::DWARFYAML::LineTableOpcode> newOpcodes;
525525 LineState state (table);
526- for (uint32_t addr : newAddrs) {
526+ for (BinaryLocation addr : newAddrs) {
527527 LineState oldState (state);
528528 state = newAddrInfo.at (addr);
529529 if (state.needToEmit ()) {
@@ -557,7 +557,7 @@ static void updateDIE(const llvm::DWARFDebugInfoEntry& DIE,
557557 auto tag = DIE.getTag ();
558558 // Pairs of low/high_pc require some special handling, as the high
559559 // may be an offset relative to the low. First, process the low_pcs.
560- uint32_t oldLowPC = 0 , newLowPC = 0 ;
560+ BinaryLocation oldLowPC = 0 , newLowPC = 0 ;
561561 iterContextAndYAML (
562562 abbrevDecl->attributes (),
563563 yamlEntry.Values ,
@@ -567,7 +567,7 @@ static void updateDIE(const llvm::DWARFDebugInfoEntry& DIE,
567567 if (attr != llvm::dwarf::DW_AT_low_pc) {
568568 return ;
569569 }
570- uint32_t oldValue = yamlValue.Value , newValue = 0 ;
570+ BinaryLocation oldValue = yamlValue.Value , newValue = 0 ;
571571 if (tag == llvm::dwarf::DW_TAG_GNU_call_site ||
572572 tag == llvm::dwarf::DW_TAG_inlined_subroutine ||
573573 tag == llvm::dwarf::DW_TAG_lexical_block ||
@@ -596,7 +596,7 @@ static void updateDIE(const llvm::DWARFDebugInfoEntry& DIE,
596596 if (attr != llvm::dwarf::DW_AT_high_pc) {
597597 return ;
598598 }
599- uint32_t oldValue = yamlValue.Value , newValue = 0 ;
599+ BinaryLocation oldValue = yamlValue.Value , newValue = 0 ;
600600 bool isRelative = attrSpec.Form == llvm::dwarf::DW_FORM_data4;
601601 if (isRelative) {
602602 oldValue += oldLowPC;
0 commit comments