Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move StopInfoOverride callback to the new architecture plugin
This creates a new Architecture plugin and moves the stop info override callback to this place. The motivation for this is to remove complex dependencies from the ArchSpec class because it is used in a lot of places that (should) know nothing about Process instances and StopInfo objects. I also add a test for the functionality covered by the override callback. Differential Revision: https://reviews.llvm.org/D31172 llvm-svn: 316609
- Loading branch information
Showing
19 changed files
with
428 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===-- Architecture.h ------------------------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_CORE_ARCHITECTURE_H | ||
#define LLDB_CORE_ARCHITECTURE_H | ||
|
||
#include "lldb/Core/PluginInterface.h" | ||
|
||
namespace lldb_private { | ||
|
||
class Architecture : public PluginInterface { | ||
public: | ||
Architecture() = default; | ||
virtual ~Architecture() = default; | ||
|
||
//------------------------------------------------------------------ | ||
/// This is currently intended to handle cases where a | ||
/// program stops at an instruction that won't get executed and it | ||
/// allows the stop reasonm, like "breakpoint hit", to be replaced | ||
/// with a different stop reason like "no stop reason". | ||
/// | ||
/// This is specifically used for ARM in Thumb code when we stop in | ||
/// an IT instruction (if/then/else) where the instruction won't get | ||
/// executed and therefore it wouldn't be correct to show the program | ||
/// stopped at the current PC. The code is generic and applies to all | ||
/// ARM CPUs. | ||
//------------------------------------------------------------------ | ||
virtual void OverrideStopInfo(Thread &thread) = 0; | ||
|
||
private: | ||
Architecture(const Architecture &) = delete; | ||
void operator=(const Architecture &) = delete; | ||
}; | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // LLDB_CORE_ARCHITECTURE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LEVEL = ../../make | ||
|
||
C_SOURCES := main.c | ||
CFLAGS_EXTRAS = -mthumb | ||
|
||
include $(LEVEL)/Makefile.rules |
45 changes: 45 additions & 0 deletions
45
lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
Test that breakpoints in an IT instruction don't fire if their condition is | ||
false. | ||
""" | ||
from __future__ import print_function | ||
|
||
|
||
import lldb | ||
import os | ||
import time | ||
from lldbsuite.test.decorators import * | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test import lldbutil | ||
|
||
|
||
class TestBreakpointIt(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
NO_DEBUG_INFO_TESTCASE = True | ||
|
||
@skipIf(archs=no_match(["arm"])) | ||
def test_false(self): | ||
self.build() | ||
exe = os.path.join(os.getcwd(), "a.out") | ||
|
||
self.runCmd("target create %s" % exe) | ||
lldbutil.run_break_set_by_symbol(self, "bkpt_false", | ||
extra_options="--skip-prologue 0") | ||
|
||
self.runCmd("run") | ||
self.assertEqual(self.process().GetState(), lldb.eStateExited, | ||
"Breakpoint does not get hit") | ||
|
||
@skipIf(archs=no_match(["arm"])) | ||
def test_true(self): | ||
self.build() | ||
exe = os.path.join(os.getcwd(), "a.out") | ||
|
||
self.runCmd("target create %s" % exe) | ||
bpid = lldbutil.run_break_set_by_symbol(self, "bkpt_true", | ||
extra_options="--skip-prologue 0") | ||
|
||
self.runCmd("run") | ||
self.assertIsNotNone(lldbutil.get_one_thread_stopped_at_breakpoint_id( | ||
self.process(), bpid)) |
14 changes: 14 additions & 0 deletions
14
lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
int main() { | ||
int value; | ||
asm ( | ||
"cmp %1, %2\n\t" | ||
"ite ne\n\t" | ||
".thumb_func\n\t" | ||
"bkpt_true:\n\t" | ||
"movne %0, %1\n\t" | ||
".thumb_func\n\t" | ||
"bkpt_false:\n\t" | ||
"moveq %0, %2\n\t" | ||
: "=r" (value) : "r"(42), "r"(47)); | ||
return value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.