summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-11-07 02:39:37 +0000
committerVedant Kumar <vsk@apple.com>2016-11-07 02:39:37 +0000
commit6ba1db9f787a373677cb9c08c0e7b7ad305604d5 (patch)
treea6d31cb22bf80f5393fb2e8a6475152c506fec81 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parentb110e0485194d1b5ba4c3cb02a8cd2ee57be92cd (diff)
downloadbcm5719-llvm-6ba1db9f787a373677cb9c08c0e7b7ad305604d5.tar.gz
bcm5719-llvm-6ba1db9f787a373677cb9c08c0e7b7ad305604d5.zip
[lldb] Fix -Waggressive-loop-optimizations warning
We shouldn't access past the end of an array, even if we think that the layout of the struct containing the array is always what we expect. The compiler is free to optimize away the stores as undefined behavior, and in fact, GCC 6.2.1 claims it will do exactly this. llvm-svn: 286093
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 04bed4eff9f..45d3b123a54 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -667,8 +667,12 @@ public:
// x0-x29 + fp + lr + sp + pc (== 33 64-bit registers) plus cpsr (1
// 32-bit register)
if (count >= (33 * 2) + 1) {
- for (uint32_t i = 0; i < 33; ++i)
+ for (uint32_t i = 0; i < 29; ++i)
gpr.x[i] = data.GetU64(&offset);
+ gpr.fp = data.GetU64(&offset);
+ gpr.lr = data.GetU64(&offset);
+ gpr.sp = data.GetU64(&offset);
+ gpr.pc = data.GetU64(&offset);
gpr.cpsr = data.GetU32(&offset);
SetError(GPRRegSet, Read, 0);
}
OpenPOWER on IntegriCloud