summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-01-17 10:14:58 -0800
committerGitHub <noreply@github.com>2020-01-17 10:14:58 -0800
commit2fe75d7f4cebddeb1a88ac3e08bc08da6f1d14bc (patch)
tree3fabf727e1688f6298981e7732065f20127f1383 /src
parent98f5507c508d6fde326347df3fcad70740b634ea (diff)
downloadbinaryen-2fe75d7f4cebddeb1a88ac3e08bc08da6f1d14bc.tar.gz
binaryen-2fe75d7f4cebddeb1a88ac3e08bc08da6f1d14bc.tar.bz2
binaryen-2fe75d7f4cebddeb1a88ac3e08bc08da6f1d14bc.zip
Update debug line info with function entries (#2600)
LLVM points to the start of the function in some debug line entries - right after the size LEB of the function, which is where the locals are declared, and before any instructions.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-debug.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp
index a4d3b2641..a8b70247f 100644
--- a/src/wasm/wasm-debug.cpp
+++ b/src/wasm/wasm-debug.cpp
@@ -447,6 +447,10 @@ struct LocationUpdater {
return 0;
}
+ bool hasOldExprAddr(BinaryLocation oldAddr) const {
+ return oldExprAddrMap.getStart(oldAddr) != nullptr;
+ }
+
BinaryLocation getNewExprEndAddr(BinaryLocation oldAddr) const {
if (auto* expr = oldExprAddrMap.getEnd(oldAddr)) {
auto iter = newLocations.expressions.find(expr);
@@ -503,7 +507,14 @@ static void updateDebugLines(llvm::DWARFYAML::Data& data,
}
// An expression may not exist for this line table item, if we optimized
// it away.
- if (auto newAddr = locationUpdater.getNewExprAddr(state.addr)) {
+ BinaryLocation oldAddr = state.addr;
+ BinaryLocation newAddr = 0;
+ if (locationUpdater.hasOldExprAddr(oldAddr)) {
+ newAddr = locationUpdater.getNewExprAddr(oldAddr);
+ } else {
+ newAddr = locationUpdater.getNewFuncAddr(oldAddr);
+ }
+ if (newAddr) {
newAddrs.push_back(newAddr);
newAddrInfo.emplace(newAddr, state);
auto& updatedState = newAddrInfo.at(newAddr);