[Lldb-commits] [lldb] r157355 - in /lldb/branches/lldb-platform-work: ./ include/lldb/API/ include/lldb/Target/ scripts/Python/interface/ source/API/ source/Commands/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Target/ test/functionalities/watchpoint/watchpoint_commands/ test/python_api/default-constructor/ test/python_api/process/ tools/debugserver/source/ tools/debugserver/source/MacOSX/
Johnny Chen
johnny.chen at apple.com
Wed May 23 15:47:10 PDT 2012
Author: johnny
Date: Wed May 23 17:47:10 2012
New Revision: 157355
URL: http://llvm.org/viewvc/llvm-project?rev=157355&view=rev
Log:
Merge changes from ToT trunk.
Modified:
lldb/branches/lldb-platform-work/ (props changed)
lldb/branches/lldb-platform-work/include/lldb/API/SBProcess.h
lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
lldb/branches/lldb-platform-work/scripts/Python/interface/SBProcess.i
lldb/branches/lldb-platform-work/source/API/SBProcess.cpp
lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/branches/lldb-platform-work/source/Target/Process.cpp
lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_process.py
lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py
lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h
lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp
lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h
Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 23 17:47:10 2012
@@ -1 +1 @@
-/lldb/trunk:154223-157302
+/lldb/trunk:154223-157353
Modified: lldb/branches/lldb-platform-work/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/API/SBProcess.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/API/SBProcess.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/API/SBProcess.h Wed May 23 17:47:10 2012
@@ -188,6 +188,9 @@
GetDescription (lldb::SBStream &description);
uint32_t
+ GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
+
+ uint32_t
LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
lldb::SBError
Modified: lldb/branches/lldb-platform-work/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/include/lldb/Target/Process.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/include/lldb/Target/Process.h (original)
+++ lldb/branches/lldb-platform-work/include/lldb/Target/Process.h Wed May 23 17:47:10 2012
@@ -2728,6 +2728,14 @@
return error;
}
+ virtual Error
+ GetWatchpointSupportInfo (uint32_t &num)
+ {
+ Error error;
+ error.SetErrorString ("Process::GetWatchpointSupportInfo() not supported");
+ return error;
+ }
+
lldb::ModuleSP
ReadModuleFromMemory (const FileSpec& file_spec,
lldb::addr_t header_addr,
Modified: lldb/branches/lldb-platform-work/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/scripts/Python/interface/SBProcess.i?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/scripts/Python/interface/SBProcess.i (original)
+++ lldb/branches/lldb-platform-work/scripts/Python/interface/SBProcess.i Wed May 23 17:47:10 2012
@@ -282,6 +282,9 @@
GetDescription (lldb::SBStream &description);
uint32_t
+ GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
+
+ uint32_t
LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
lldb::SBError
Modified: lldb/branches/lldb-platform-work/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/API/SBProcess.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/API/SBProcess.cpp (original)
+++ lldb/branches/lldb-platform-work/source/API/SBProcess.cpp Wed May 23 17:47:10 2012
@@ -1001,6 +1001,29 @@
}
uint32_t
+SBProcess::GetNumSupportedHardwareWatchpoints (lldb::SBError &sb_error) const
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ uint32_t num = 0;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
+ process_sp.get(), num);
+ }
+ else
+ {
+ sb_error.SetErrorString ("SBProcess is invalid");
+ }
+ return num;
+}
+
+uint32_t
SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error)
{
ProcessSP process_sp(GetSP());
Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectWatchpoint.cpp Wed May 23 17:47:10 2012
@@ -290,6 +290,15 @@
return true;
}
+ if (target->GetProcessSP() && target->GetProcessSP()->IsAlive())
+ {
+ uint32_t num_supported_hardware_watchpoints;
+ Error error = target->GetProcessSP()->GetWatchpointSupportInfo(num_supported_hardware_watchpoints);
+ if (error.Success())
+ result.AppendMessageWithFormat("Number of supported hardware watchpoints: %u\n",
+ num_supported_hardware_watchpoints);
+ }
+
const WatchpointList &watchpoints = target->GetWatchpointList();
Mutex::Locker locker;
target->GetWatchpointList().GetListMutex(locker);
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed May 23 17:47:10 2012
@@ -49,6 +49,7 @@
m_qHostInfo_is_valid (eLazyBoolCalculate),
m_supports_alloc_dealloc_memory (eLazyBoolCalculate),
m_supports_memory_region_info (eLazyBoolCalculate),
+ m_supports_watchpoint_support_info (eLazyBoolCalculate),
m_supports_qProcessInfoPID (true),
m_supports_qfProcessInfo (true),
m_supports_qUserName (true),
@@ -61,6 +62,7 @@
m_supports_z4 (true),
m_curr_tid (LLDB_INVALID_THREAD_ID),
m_curr_tid_run (LLDB_INVALID_THREAD_ID),
+ m_num_supported_hardware_watchpoints (0),
m_async_mutex (Mutex::eMutexTypeRecursive),
m_async_packet_predicate (false),
m_async_packet (),
@@ -1287,6 +1289,52 @@
}
+Error
+GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num)
+{
+ Error error;
+
+ if (m_supports_watchpoint_support_info == eLazyBoolYes)
+ {
+ num = m_num_supported_hardware_watchpoints;
+ return error;
+ }
+
+ // Set num to 0 first.
+ num = 0;
+ if (m_supports_watchpoint_support_info != eLazyBoolNo)
+ {
+ char packet[64];
+ const int packet_len = ::snprintf(packet, sizeof(packet), "qWatchpointSupportInfo:");
+ assert (packet_len < sizeof(packet));
+ StringExtractorGDBRemote response;
+ if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+ {
+ m_supports_watchpoint_support_info = eLazyBoolYes;
+ std::string name;
+ std::string value;
+ while (response.GetNameColonValue(name, value))
+ {
+ if (name.compare ("num") == 0)
+ {
+ num = Args::StringToUInt32(value.c_str(), 0, 0);
+ m_num_supported_hardware_watchpoints = num;
+ }
+ }
+ }
+ else
+ {
+ m_supports_watchpoint_support_info = eLazyBoolNo;
+ }
+ }
+
+ if (m_supports_watchpoint_support_info == eLazyBoolNo)
+ {
+ error.SetErrorString("qWatchpointSupportInfo is not supported");
+ }
+ return error;
+
+}
int
GDBRemoteCommunicationClient::SetSTDIN (char const *path)
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Wed May 23 17:47:10 2012
@@ -206,6 +206,9 @@
GetMemoryRegionInfo (lldb::addr_t addr,
lldb_private::MemoryRegionInfo &range_info);
+ lldb_private::Error
+ GetWatchpointSupportInfo (uint32_t &num);
+
const lldb_private::ArchSpec &
GetHostArchitecture ();
@@ -394,6 +397,7 @@
lldb_private::LazyBool m_qHostInfo_is_valid;
lldb_private::LazyBool m_supports_alloc_dealloc_memory;
lldb_private::LazyBool m_supports_memory_region_info;
+ lldb_private::LazyBool m_supports_watchpoint_support_info;
bool
m_supports_qProcessInfoPID:1,
@@ -412,6 +416,8 @@
lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc
+ uint32_t m_num_supported_hardware_watchpoints;
+
// If we need to send a packet while the target is running, the m_async_XXX
// member variables take care of making this happen.
lldb_private::Mutex m_async_mutex;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed May 23 17:47:10 2012
@@ -70,7 +70,7 @@
if (error.Success())
((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory (strm);
}
-};
+}
#define DEBUGSERVER_BASENAME "debugserver"
@@ -1858,6 +1858,14 @@
}
Error
+ProcessGDBRemote::GetWatchpointSupportInfo (uint32_t &num)
+{
+
+ Error error (m_gdb_comm.GetWatchpointSupportInfo (num));
+ return error;
+}
+
+Error
ProcessGDBRemote::DoDeallocateMemory (lldb::addr_t addr)
{
Error error;
Modified: lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Wed May 23 17:47:10 2012
@@ -204,6 +204,9 @@
virtual lldb_private::Error
DisableWatchpoint (lldb_private::Watchpoint *wp);
+ virtual lldb_private::Error
+ GetWatchpointSupportInfo (uint32_t &num);
+
virtual bool
StartNoticingNewThreads();
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Wed May 23 17:47:10 2012
@@ -86,7 +86,7 @@
uint32_t Length() const { return prologue_length + sizeof(total_length) + sizeof(version) + sizeof(prologue_length); }
// Length of the line table data in bytes (not including the prologue)
uint32_t StatementTableLength() const { return total_length + sizeof(total_length) - Length(); }
- int32_t MaxLineIncrementForSpecialOpcode() const { return line_base + (int8_t)line_range - 1; };
+ int32_t MaxLineIncrementForSpecialOpcode() const { return line_base + (int8_t)line_range - 1; }
bool IsValid() const;
// void Append(BinaryStreamBuf& buff) const;
void Dump (lldb_private::Log *log);
Modified: lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed May 23 17:47:10 2012
@@ -1410,7 +1410,7 @@
{
if (parent_die == NULL)
- return NULL;
+ return false;
Args template_parameter_names;
for (const DWARFDebugInfoEntry *die = parent_die->GetFirstChild();
Modified: lldb/branches/lldb-platform-work/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Process.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Process.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Process.cpp Wed May 23 17:47:10 2012
@@ -2553,6 +2553,7 @@
{
--m_exec_count;
m_process->PrivateResume ();
+ Process::ProcessEventData::SetRestartedInEvent (event_sp.get(), true);
return eEventActionRetry;
}
else
@@ -3026,6 +3027,31 @@
if (error.Success())
{
DisableAllBreakpointSites();
+ if (m_public_state.GetValue() == eStateRunning)
+ {
+ error = Halt();
+ if (error.Success())
+ {
+ // Consume the halt event.
+ EventSP stop_event;
+ TimeValue timeout (TimeValue::Now());
+ timeout.OffsetWithMicroSeconds(1000);
+ StateType state = WaitForProcessToStop (&timeout);
+ if (state != eStateStopped)
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("Process::Destroy() Halt failed to stop, state is: %s", StateAsCString(state));
+ }
+ }
+ else
+ {
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf("Process::Destroy() Halt got error: %s", error.AsCString());
+ }
+ }
+
error = DoDestroy();
if (error.Success())
{
Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py Wed May 23 17:47:10 2012
@@ -128,7 +128,8 @@
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs = ['Number of supported hardware watchpoints:',
+ 'hit_count = 0'])
self.runCmd("process continue")
Modified: lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_process.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_process.py?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_process.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/default-constructor/sb_process.py Wed May 23 17:47:10 2012
@@ -44,5 +44,6 @@
obj.LoadImage(lldb.SBFileSpec(), error)
obj.UnloadImage(0)
obj.Clear()
+ obj.GetNumSupportedHardwareWatchpoints(error)
for thread in obj:
print thread
Modified: lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/process/TestProcessAPI.py Wed May 23 17:47:10 2012
@@ -63,6 +63,12 @@
self.buildDefault()
self.remote_launch_should_fail()
+ @python_api_test
+ def test_get_num_supported_hardware_watchpoints(self):
+ """Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process."""
+ self.buildDefault()
+ self.get_num_supported_hardware_watchpoints()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -306,6 +312,25 @@
success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected")
+ def get_num_supported_hardware_watchpoints(self):
+ """Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Launch the process, and do not stop at the entry point.
+ process = target.LaunchSimple(None, None, os.getcwd())
+
+ error = lldb.SBError();
+ num = process.GetNumSupportedHardwareWatchpoints(error)
+ if self.TraceOn() and error.Success():
+ print "Number of supported hardware watchpoints: %d" % num
+
if __name__ == '__main__':
import atexit
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.cpp Wed May 23 17:47:10 2012
@@ -1081,6 +1081,18 @@
}
//----------------------------------------------------------------------
+// Return the number of supported hardware watchpoints.
+//----------------------------------------------------------------------
+uint32_t
+DNBWatchpointGetNumSupportedHWP (nub_process_t pid)
+{
+ MachProcessSP procSP;
+ if (GetProcessSP (pid, procSP))
+ return procSP->GetNumSupportedHardwareWatchpoints();
+ return 0;
+}
+
+//----------------------------------------------------------------------
// Read memory in the address space of process PID. This call will take
// care of setting and restoring permissions and breaking up the memory
// read into multiple chunks as required.
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNB.h Wed May 23 17:47:10 2012
@@ -138,6 +138,7 @@
nub_bool_t DNBWatchpointSetIgnoreCount (nub_process_t pid, nub_watch_t watchID, nub_size_t ignore_count) DNB_EXPORT;
nub_bool_t DNBWatchpointSetCallback (nub_process_t pid, nub_watch_t watchID, DNBCallbackBreakpointHit callback, void *baton) DNB_EXPORT;
void DNBWatchpointPrint (nub_process_t pid, nub_watch_t watchID) DNB_EXPORT;
+uint32_t DNBWatchpointGetNumSupportedHWP (nub_process_t pid) DNB_EXPORT;
const DNBRegisterSetInfo *
DNBGetRegisterSetInfo (nub_size_t *num_reg_sets) DNB_EXPORT;
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.cpp Wed May 23 17:47:10 2012
@@ -944,6 +944,12 @@
}
}
+uint32_t
+MachProcess::GetNumSupportedHardwareWatchpoints () const
+{
+ return m_thread_list.NumSupportedHardwareWatchpoints();
+}
+
bool
MachProcess::EnableBreakpoint(nub_break_t breakID)
{
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachProcess.h Wed May 23 17:47:10 2012
@@ -131,6 +131,7 @@
nub_size_t DisableAllWatchpoints (bool remove);
bool EnableWatchpoint (nub_watch_t watchID);
void DumpWatchpoint(nub_watch_t watchID) const;
+ uint32_t GetNumSupportedHardwareWatchpoints () const;
DNBBreakpointList& Watchpoints() { return m_watchpoints; }
const DNBBreakpointList& Watchpoints() const { return m_watchpoints; }
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp Wed May 23 17:47:10 2012
@@ -715,6 +715,12 @@
return false;
}
+uint32_t
+MachThread::NumSupportedHardwareWatchpoints () const
+{
+ return m_arch_ap->NumSupportedHardwareWatchpoints();
+}
+
bool
MachThread::GetIdentifierInfo ()
{
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h Wed May 23 17:47:10 2012
@@ -65,6 +65,7 @@
uint32_t EnableHardwareWatchpoint (const DNBBreakpoint *watchpoint);
bool DisableHardwareBreakpoint (const DNBBreakpoint *breakpoint);
bool DisableHardwareWatchpoint (const DNBBreakpoint *watchpoint);
+ uint32_t NumSupportedHardwareWatchpoints () const;
nub_state_t GetState();
void SetState(nub_state_t state);
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp Wed May 23 17:47:10 2012
@@ -509,6 +509,17 @@
}
uint32_t
+MachThreadList::NumSupportedHardwareWatchpoints () const
+{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
+ const uint32_t num_threads = m_threads.size();
+ // Use an arbitrary thread to retrieve the number of supported hardware watchpoints.
+ if (num_threads)
+ return m_threads[0]->NumSupportedHardwareWatchpoints();
+ return 0;
+}
+
+uint32_t
MachThreadList::GetThreadIndexForThreadStoppedWithSignal (const int signo) const
{
PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.h Wed May 23 17:47:10 2012
@@ -50,6 +50,8 @@
bool DisableHardwareBreakpoint (const DNBBreakpoint *bp) const;
uint32_t EnableHardwareWatchpoint (const DNBBreakpoint *wp) const;
bool DisableHardwareWatchpoint (const DNBBreakpoint *wp) const;
+ uint32_t NumSupportedHardwareWatchpoints () const;
+
uint32_t GetThreadIndexForThreadStoppedWithSignal (const int signo) const;
MachThreadSP GetThreadByID (nub_thread_t tid) const;
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.cpp Wed May 23 17:47:10 2012
@@ -189,6 +189,7 @@
t.push_back (Packet (allocate_memory, &RNBRemote::HandlePacket_AllocateMemory, NULL, "_M", "Allocate memory in the inferior process."));
t.push_back (Packet (deallocate_memory, &RNBRemote::HandlePacket_DeallocateMemory, NULL, "_m", "Deallocate memory in the inferior process."));
t.push_back (Packet (memory_region_info, &RNBRemote::HandlePacket_MemoryRegionInfo, NULL, "qMemoryRegionInfo", "Return size and attributes of a memory region that contains the given address"));
+ t.push_back (Packet (watchpoint_support_info, &RNBRemote::HandlePacket_WatchpointSupportInfo, NULL, "qWatchpointSupportInfo", "Return the number of supported hardware watchpoints"));
}
@@ -3361,6 +3362,33 @@
return SendPacket (ostrm.str());
}
+rnb_err_t
+RNBRemote::HandlePacket_WatchpointSupportInfo (const char *p)
+{
+ /* This packet simply returns the number of supported hardware watchpoints.
+
+ Examples of use:
+ qWatchpointSupportInfo:
+ num:4
+
+ qWatchpointSupportInfo
+ OK // this packet is implemented by the remote nub
+ */
+
+ p += sizeof ("qWatchpointSupportInfo") - 1;
+ if (*p == '\0')
+ return SendPacket ("OK");
+ if (*p++ != ':')
+ return SendPacket ("E67");
+
+ errno = 0;
+ uint32_t num = DNBWatchpointGetNumSupportedHWP (m_ctx.ProcessID());
+ std::ostringstream ostrm;
+
+ // size:4
+ ostrm << "num:" << std::dec << num << ';';
+ return SendPacket (ostrm.str());
+}
/* 'C sig [;addr]'
Resume with signal sig, optionally at address addr. */
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h?rev=157355&r1=157354&r2=157355&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/RNBRemote.h Wed May 23 17:47:10 2012
@@ -108,6 +108,7 @@
set_working_dir, // 'QSetWorkingDir:'
set_list_threads_in_stop_reply, // 'QListThreadsInStopReply:'
memory_region_info, // 'qMemoryRegionInfo:'
+ watchpoint_support_info, // 'qWatchpointSupportInfo:'
allocate_memory, // '_M'
deallocate_memory, // '_m'
@@ -202,6 +203,7 @@
rnb_err_t HandlePacket_AllocateMemory (const char *p);
rnb_err_t HandlePacket_DeallocateMemory (const char *p);
rnb_err_t HandlePacket_MemoryRegionInfo (const char *p);
+ rnb_err_t HandlePacket_WatchpointSupportInfo (const char *p);
rnb_err_t HandlePacket_stop_process (const char *p);
More information about the lldb-commits
mailing list