diff options
author | Jim Ingham <jingham@apple.com> | 2013-06-18 21:52:48 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2013-06-18 21:52:48 +0000 |
commit | c64623179b7911e3ce932d91b6a89508a1379b75 (patch) | |
tree | 9720bd8a9cf70685eb8cacb95d94f147a5bedfb6 /lldb/source/Commands/CommandObjectWatchpoint.cpp | |
parent | a6ed57d8dd8dbcfc2720e25771366c640fc0d1bf (diff) | |
download | bcm5719-llvm-c64623179b7911e3ce932d91b6a89508a1379b75.tar.gz bcm5719-llvm-c64623179b7911e3ce932d91b6a89508a1379b75.zip |
We were getting an assert because somebody was making a watchpoint that was
neither read nor write. Tighten up the checking so this isn't possible.
<rdar://problem/14111167>
llvm-svn: 184245
Diffstat (limited to 'lldb/source/Commands/CommandObjectWatchpoint.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 2f350ee6062..bed490a7aa2 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -1066,6 +1066,7 @@ protected: // Now it's time to create the watchpoint. uint32_t watch_type = m_option_watchpoint.watch_type; + error.Clear(); Watchpoint *wp = target->CreateWatchpoint(addr, size, &type, watch_type, error).get(); if (wp) @@ -1221,16 +1222,13 @@ protected: // If no argument is present, issue an error message. There's no way to set a watchpoint. if (command.GetArgumentCount() == 0) { - result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the addres to watch for\n"); + result.GetErrorStream().Printf("error: required argument missing; specify an expression to evaulate into the address to watch for\n"); result.SetStatus(eReturnStatusFailed); return false; } - bool with_dash_w = m_option_watchpoint.watch_type_specified; - bool with_dash_x = (m_option_watchpoint.watch_size != 0); - // If no '-w' is specified, default to '-w write'. - if (!with_dash_w) + if (!m_option_watchpoint.watch_type_specified) { m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite; } @@ -1271,8 +1269,11 @@ protected: result.SetStatus(eReturnStatusFailed); return false; } - size = with_dash_x ? m_option_watchpoint.watch_size - : target->GetArchitecture().GetAddressByteSize(); + + if (m_option_watchpoint.watch_size != 0) + size = m_option_watchpoint.watch_size; + else + size = target->GetArchitecture().GetAddressByteSize(); // Now it's time to create the watchpoint. uint32_t watch_type = m_option_watchpoint.watch_type; |