Skip to content

Commit 30dc51a

Browse files
committed
NEW1 [ci skip]
1 parent e873e2a commit 30dc51a

File tree

6 files changed

+839
-757
lines changed

6 files changed

+839
-757
lines changed

src/wasm/wasm-debug.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ struct LocationUpdater {
447447
return 0;
448448
}
449449

450+
bool hasOldExprAddr(BinaryLocation oldAddr) const {
451+
return oldExprAddrMap.getStart(oldAddr) != nullptr;
452+
}
453+
450454
BinaryLocation getNewExprEndAddr(BinaryLocation oldAddr) const {
451455
if (auto* expr = oldExprAddrMap.getEnd(oldAddr)) {
452456
auto iter = newLocations.expressions.find(expr);
@@ -503,7 +507,14 @@ static void updateDebugLines(llvm::DWARFYAML::Data& data,
503507
}
504508
// An expression may not exist for this line table item, if we optimized
505509
// it away.
506-
if (auto newAddr = locationUpdater.getNewExprAddr(state.addr)) {
510+
BinaryLocation oldAddr = state.addr;
511+
BinaryLocation newAddr = 0;
512+
if (locationUpdater.hasOldExprAddr(oldAddr)) {
513+
newAddr = locationUpdater.getNewExprAddr(oldAddr);
514+
} else {
515+
newAddr = locationUpdater.getNewFuncAddr(oldAddr);
516+
}
517+
if (newAddr) {
507518
newAddrs.push_back(newAddr);
508519
newAddrInfo.emplace(newAddr, state);
509520
auto& updatedState = newAddrInfo.at(newAddr);

0 commit comments

Comments
 (0)