aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-16 19:03:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-16 19:03:14 +0000
commit88e1e103de334d2aec9d261bc4264d3916ba410d (patch)
tree212155238e080c5a1d3d73a4b153b6b88b5061a5 /lib/MC
parent4306e87c6151c225340ee792365a601224bd7bcf (diff)
downloadexternal_llvm-88e1e103de334d2aec9d261bc4264d3916ba410d.zip
external_llvm-88e1e103de334d2aec9d261bc4264d3916ba410d.tar.gz
external_llvm-88e1e103de334d2aec9d261bc4264d3916ba410d.tar.bz2
Create an atom with just the data that failed to disassemble.
Patch by Stephen Checkoway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192827 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCObjectDisassembler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/MC/MCObjectDisassembler.cpp b/lib/MC/MCObjectDisassembler.cpp
index fa46637..16a110f 100644
--- a/lib/MC/MCObjectDisassembler.cpp
+++ b/lib/MC/MCObjectDisassembler.cpp
@@ -135,11 +135,13 @@ void MCObjectDisassembler::buildSectionAtoms(MCModule *Module) {
Text->addInst(Inst, InstSize);
InvalidData = 0;
} else {
+ assert(InstSize && "getInstruction() consumed no bytes");
if (!InvalidData) {
Text = 0;
- InvalidData = Module->createDataAtom(CurAddr, EndAddr);
+ InvalidData = Module->createDataAtom(CurAddr, CurAddr+InstSize - 1);
}
- InvalidData->addData(Contents[Index]);
+ for (uint64_t I = 0; I < InstSize; ++I)
+ InvalidData->addData(Contents[Index+I]);
}
}
} else {