Revert "Fix a problem with "watchpoint triggers before" watchpoint handling."

This reverts commit 8d024a79ea.

I accidentally included some "in progress" work that wasn't supposed to
go with this commit.
This commit is contained in:
Jim Ingham
2023-03-20 16:05:01 -07:00
parent e520800eda
commit 9b655c2627
6 changed files with 41 additions and 85 deletions

View File

@@ -311,14 +311,6 @@ public:
return m_last_natural_stop_event;
return lldb::EventSP();
}
void SetSafeToCallFunctions(bool safe) {
m_safe = safe;
}
bool GetSafeToCallFunctions() {
return m_safe;
}
private:
uint32_t m_stop_id = 0;
@@ -329,7 +321,6 @@ private:
uint32_t m_running_user_expression = false;
uint32_t m_running_utility_function = 0;
lldb::EventSP m_last_natural_stop_event;
std::atomic<bool> m_safe = true;
};
inline bool operator==(const ProcessModID &lhs, const ProcessModID &rhs) {
@@ -468,7 +459,7 @@ public:
void SetRestarted(bool new_value) { m_restarted = new_value; }
void SetInterrupted(bool new_value) { m_interrupted = new_value; }
void AddRestartedReason(const char *reason) {
m_restarted_reasons.push_back(reason);
}
@@ -1259,14 +1250,6 @@ public:
DiagnosticManager &diagnostic_manager);
static const char *ExecutionResultAsCString(lldb::ExpressionResults result);
void SetSafeToCallFunctions(bool safe) {
GetModID().SetSafeToCallFunctions(safe);
}
bool GetSafeToCallFunctions() {
return GetModID().GetSafeToCallFunctions();
}
void GetStatus(Stream &ostrm);

View File

@@ -795,19 +795,6 @@ StopInfoSP StopInfoMachException::CreateStopReasonWithMachException(
case 9: // EXC_RPC_ALERT
case 10: // EXC_CRASH
break;
case 12: // EXC_GUARD
{
// Some EXC_GUARD exceptions are fatal, and the process will go away
// the next time you allow it to run. When we get one of those
// exceptions we have to make sure SafeToCallFunctions returns false to
// prevent us or other agents running the process. This has to be set
// on the process because even the threads that didn't get the exception
// can't run.
ProcessSP process_sp(thread.GetProcess());
if (process_sp)
process_sp->SetSafeToCallFunctions(false);
}
}
return StopInfoSP(new StopInfoMachException(thread, exc_type, exc_data_count,

View File

@@ -831,11 +831,6 @@ protected:
= std::static_pointer_cast<StopInfoWatchpoint>(shared_from_this());
ThreadPlanSP step_over_wp_sp(new ThreadPlanStepOverWatchpoint(
*(thread_sp.get()), me_as_siwp_sp, wp_sp));
// When this plan is done we want to stop, so set this as a Controlling
// plan.
step_over_wp_sp->SetIsControllingPlan(true);
step_over_wp_sp->SetOkayToDiscard(false);
Status error;
error = thread_sp->QueueThreadPlan(step_over_wp_sp, false);
// If we couldn't push the thread plan, just stop here:

View File

@@ -1664,9 +1664,6 @@ addr_t Thread::GetThreadLocalData(const ModuleSP module,
bool Thread::SafeToCallFunctions() {
Process *process = GetProcess().get();
if (process) {
if (!process->SafeToCallFunctions())
return false;
DynamicLoader *loader = GetProcess()->GetDynamicLoader();
if (loader && loader->IsFullyInitialized() == false)
return false;

View File

@@ -11,48 +11,6 @@ from lldbsuite.test import lldbutil
class TestStepOverWatchpoint(TestBase):
NO_DEBUG_INFO_TESTCASE = True
def get_to_start(self, bkpt_text):
"""Test stepping over watchpoints."""
self.build()
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(self, bkpt_text,
lldb.SBFileSpec("main.c"))
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid(), "Failed to get frame.")
read_value = frame.FindValue('g_watch_me_read',
lldb.eValueTypeVariableGlobal)
self.assertTrue(read_value.IsValid(), "Failed to find read value.")
error = lldb.SBError()
# resolve_location=True, read=True, write=False
read_watchpoint = read_value.Watch(True, True, False, error)
self.assertSuccess(error, "Error while setting watchpoint")
self.assertTrue(read_watchpoint, "Failed to set read watchpoint.")
# Disable the breakpoint we hit so we don't muddy the waters with
# stepping off from the breakpoint:
bkpt.SetEnabled(False)
return (target, process, thread, read_watchpoint)
@expectedFailureAll(
oslist=["freebsd", "linux"],
archs=[
'aarch64',
'arm'],
bugnumber="llvm.org/pr26031")
# Read-write watchpoints not supported on SystemZ
@expectedFailureAll(archs=['s390x'])
@add_test_categories(["basic_process"])
def test_step_over(self):
target, process, thread, wp = self.get_to_start("Set a breakpoint here")
thread.StepOver()
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 1')
@expectedFailureAll(
oslist=["freebsd", "linux"],
archs=[
@@ -66,9 +24,45 @@ class TestStepOverWatchpoint(TestBase):
archs=['aarch64', 'arm'],
bugnumber="<rdar://problem/34027183>")
@add_test_categories(["basic_process"])
def test_step_instruction(self):
target, process, thread, wp = self.get_to_start("Set breakpoint after call")
def test(self):
"""Test stepping over watchpoints."""
self.build()
target = self.createTestTarget()
lldbutil.run_break_set_by_symbol(self, 'main')
process = target.LaunchSimple(None, None,
self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
self.assertState(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
thread = lldbutil.get_stopped_thread(process,
lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid(), "Failed to get thread.")
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid(), "Failed to get frame.")
read_value = frame.FindValue('g_watch_me_read',
lldb.eValueTypeVariableGlobal)
self.assertTrue(read_value.IsValid(), "Failed to find read value.")
error = lldb.SBError()
# resolve_location=True, read=True, write=False
read_watchpoint = read_value.Watch(True, True, False, error)
self.assertSuccess(error, "Error while setting watchpoint")
self.assertTrue(read_watchpoint, "Failed to set read watchpoint.")
thread.StepOver()
self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonWatchpoint,
STOPPED_DUE_TO_WATCHPOINT)
self.assertEquals(thread.GetStopDescription(20), 'watchpoint 1')
process.Continue()
self.assertState(process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
self.assertEquals(thread.GetStopDescription(20), 'step over')
self.step_inst_for_watchpoint(1)

View File

@@ -11,8 +11,8 @@ void watch_write() {
}
int main() {
watch_read(); // Set a breakpoint here
g_temp = g_watch_me_read; // Set breakpoint after call
watch_read();
g_temp = g_watch_me_read;
watch_write();
g_watch_me_write = g_temp;
return 0;