[Lldb-commits] [lldb] r157385 - in /lldb/branches/apple/python-GIL: ./ include/lldb/API/ include/lldb/Target/ lldb.xcodeproj/ scripts/ scripts/Python/ scripts/Python/interface/ source/API/ source/Commands/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ source/Target/ test/functionalities/completion/ test/functionalities/register/ test/functionalities/watchpoint/watchpoint_commands/ test/python_api/default-constructor/ test/python_api/process/ tools/debugserver/source/ tools/debugserver/source/MacOSX/
Filipe Cabecinhas
me at filcab.net
Thu May 24 03:13:48 PDT 2012
Author: filcab
Date: Thu May 24 05:13:48 2012
New Revision: 157385
URL: http://llvm.org/viewvc/llvm-project?rev=157385&view=rev
Log:
Merge changes from ToT trunk.
Modified:
lldb/branches/apple/python-GIL/ (props changed)
lldb/branches/apple/python-GIL/include/lldb/API/SBProcess.h
lldb/branches/apple/python-GIL/include/lldb/Target/Process.h
lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj
lldb/branches/apple/python-GIL/llvm.zip
lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh
lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i
lldb/branches/apple/python-GIL/scripts/llvm.amalgamated.diff
lldb/branches/apple/python-GIL/source/API/SBProcess.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectProcess.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectWatchpoint.cpp
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/branches/apple/python-GIL/source/Target/Process.cpp
lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py
lldb/branches/apple/python-GIL/test/functionalities/register/TestRegisters.py
lldb/branches/apple/python-GIL/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
lldb/branches/apple/python-GIL/test/python_api/default-constructor/sb_process.py
lldb/branches/apple/python-GIL/test/python_api/process/TestProcessAPI.py
lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.cpp
lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.h
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.h
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.cpp
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.h
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.h
lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.cpp
lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.h
Propchange: lldb/branches/apple/python-GIL/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 24 05:13:48 2012
@@ -1 +1 @@
-/lldb/trunk:156467-157275
+/lldb/trunk:156467-157363
Modified: lldb/branches/apple/python-GIL/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/API/SBProcess.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/API/SBProcess.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/API/SBProcess.h Thu May 24 05:13:48 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/apple/python-GIL/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Target/Process.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Target/Process.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Target/Process.h Thu May 24 05:13:48 2012
@@ -794,7 +794,8 @@
ProcessInstanceInfo(),
m_plugin_name (),
m_resume_count (0),
- m_wait_for_launch (false)
+ m_wait_for_launch (false),
+ m_continue_once_attached (false)
{
}
@@ -802,7 +803,8 @@
ProcessInstanceInfo(),
m_plugin_name (),
m_resume_count (0),
- m_wait_for_launch (false)
+ m_wait_for_launch (false),
+ m_continue_once_attached (false)
{
ProcessInfo::operator= (launch_info);
SetProcessPluginName (launch_info.GetProcessPluginName());
@@ -821,6 +823,18 @@
m_wait_for_launch = b;
}
+ bool
+ GetContinueOnceAttached () const
+ {
+ return m_continue_once_attached;
+ }
+
+ void
+ SetContinueOnceAttached (bool b)
+ {
+ m_continue_once_attached = b;
+ }
+
uint32_t
GetResumeCount () const
{
@@ -874,6 +888,7 @@
std::string m_plugin_name;
uint32_t m_resume_count; // How many times do we resume after launching
bool m_wait_for_launch;
+ bool m_continue_once_attached; // Supports the use-case scenario of immediately continuing the process once attached.
};
class ProcessLaunchCommandOptions : public Options
@@ -2722,6 +2737,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/apple/python-GIL/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/branches/apple/python-GIL/lldb.xcodeproj/project.pbxproj Thu May 24 05:13:48 2012
@@ -4058,6 +4058,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ LLDB_DISABLE_PYTHON = 0;
+ "LLDB_DISABLE_PYTHON[sdk=iphoneos*]" = 1;
LLDB_FRAMEWORK_INSTALL_DIR = /Applications/Xcode.app/Contents/SharedFrameworks;
LLDB_TOOLS_INSTALL_DIR = /usr/bin;
LLVM_BUILD_DIR = "$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
@@ -4069,6 +4071,7 @@
"-flimit-debug-info",
"-Wparentheses",
);
+ SDKROOT = macosx;
STRIP_INSTALLED_PRODUCT = NO;
STRIP_STYLE = debugging;
VALID_ARCHS = "armv4t armv5 armv6 armv7 armv7s i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -4111,6 +4114,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ LLDB_DISABLE_PYTHON = 0;
+ "LLDB_DISABLE_PYTHON[sdk=iphoneos*]" = 1;
LLDB_FRAMEWORK_INSTALL_DIR = /Applications/Xcode.app/Contents/SharedFrameworks;
LLDB_TOOLS_INSTALL_DIR = /usr/bin;
LLVM_BUILD_DIR = "$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
@@ -4475,6 +4480,8 @@
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ LLDB_DISABLE_PYTHON = 0;
+ "LLDB_DISABLE_PYTHON[sdk=iphoneos*]" = 1;
LLDB_FRAMEWORK_INSTALL_DIR = /Applications/Xcode.app/Contents/SharedFrameworks;
"LLDB_FRAMEWORK_INSTALL_DIR[sdk=iphoneos*]" = /System/Library/PrivateFrameworks;
LLDB_TOOLS_INSTALL_DIR = /Applications/Xcode.app/Contents/Developer/usr/bin;
Modified: lldb/branches/apple/python-GIL/llvm.zip
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/llvm.zip?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
Binary files - no diff available.
Modified: lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/build-swig-Python.sh Thu May 24 05:13:48 2012
@@ -24,7 +24,12 @@
swig_python_wrapper=${SRC_ROOT}/scripts/Python/python-wrapper.swig
swig_python_typemaps=${SRC_ROOT}/scripts/Python/python-typemaps.swig
-if [ "x$SDKROOT" = "x" ] ; then
+if [ $LLDB_DISABLE_PYTHON = "1" ] ; then
+ # SDKROOT was not empty, which currently means iOS cross build where python is disabled
+ rm -rf ${swig_output_file}
+ touch ${swig_output_file}
+
+else
if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
then
@@ -303,8 +308,4 @@
fi
fi
-else
- # SDKROOT was not empty, which currently means iOS cross build where python is disabled
- rm -rf ${swig_output_file}
- touch ${swig_output_file}
fi
Modified: lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i (original)
+++ lldb/branches/apple/python-GIL/scripts/Python/interface/SBProcess.i Thu May 24 05:13:48 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/apple/python-GIL/scripts/llvm.amalgamated.diff
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/scripts/llvm.amalgamated.diff?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/scripts/llvm.amalgamated.diff (original)
+++ lldb/branches/apple/python-GIL/scripts/llvm.amalgamated.diff Thu May 24 05:13:48 2012
@@ -360,7 +360,33 @@
break;
}
-@@ -2837,19 +2887,25 @@
+@@ -2555,7 +2605,6 @@
+ unsigned Rm = fieldFromInstruction32(Insn, 0, 4);
+ unsigned align = fieldFromInstruction32(Insn, 4, 1);
+ unsigned size = 1 << fieldFromInstruction32(Insn, 6, 2);
+- unsigned pred = fieldFromInstruction32(Insn, 22, 4);
+ align *= 2*size;
+
+ switch (Inst.getOpcode()) {
+@@ -2586,16 +2635,11 @@
+ return MCDisassembler::Fail;
+ Inst.addOperand(MCOperand::CreateImm(align));
+
+- if (Rm == 0xD)
+- Inst.addOperand(MCOperand::CreateReg(0));
+- else if (Rm != 0xF) {
++ if (Rm != 0xD && Rm != 0xF) {
+ if (!Check(S, DecodeGPRRegisterClass(Inst, Rm, Address, Decoder)))
+ return MCDisassembler::Fail;
+ }
+
+- if (!Check(S, DecodePredicateOperand(Inst, pred, Address, Decoder)))
+- return MCDisassembler::Fail;
+-
+ return S;
+ }
+
+@@ -2837,19 +2881,25 @@
static DecodeStatus DecodeThumbBROperand(llvm::MCInst &Inst, unsigned Val,
uint64_t Address, const void *Decoder) {
@@ -389,7 +415,7 @@
return MCDisassembler::Success;
}
-@@ -3162,10 +3218,25 @@
+@@ -3162,10 +3212,25 @@
static DecodeStatus DecodeThumbBLXOffset(llvm::MCInst &Inst, unsigned Val,
uint64_t Address, const void *Decoder) {
@@ -417,7 +443,7 @@
return MCDisassembler::Success;
}
-@@ -3271,15 +3342,32 @@
+@@ -3271,15 +3336,32 @@
static DecodeStatus
DecodeThumbBCCTargetOperand(llvm::MCInst &Inst, unsigned Val,
uint64_t Address, const void *Decoder){
Modified: lldb/branches/apple/python-GIL/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/API/SBProcess.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/API/SBProcess.cpp (original)
+++ lldb/branches/apple/python-GIL/source/API/SBProcess.cpp Thu May 24 05:13:48 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/apple/python-GIL/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectProcess.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectProcess.cpp Thu May 24 05:13:48 2012
@@ -320,6 +320,10 @@
bool success = false;
switch (short_option)
{
+ case 'c':
+ attach_info.SetContinueOnceAttached(true);
+ break;
+
case 'p':
{
lldb::pid_t pid = Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
@@ -591,6 +595,10 @@
result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
old_arch_spec.GetArchitectureName(), target->GetArchitecture().GetArchitectureName());
}
+
+ // This supports the use-case scenario of immediately continuing the process once attached.
+ if (m_options.attach_info.GetContinueOnceAttached())
+ m_interpreter.HandleCommand("process continue", false, result);
}
return result.Succeeded();
}
@@ -610,10 +618,11 @@
OptionDefinition
CommandObjectProcessAttach::CommandOptions::g_option_table[] =
{
-{ LLDB_OPT_SET_ALL, false, "plugin", 'P', required_argument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
-{ LLDB_OPT_SET_1, false, "pid", 'p', required_argument, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
-{ LLDB_OPT_SET_2, false, "name", 'n', required_argument, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
-{ LLDB_OPT_SET_2, false, "waitfor",'w', no_argument, NULL, 0, eArgTypeNone, "Wait for the the process with <process-name> to launch."},
+{ LLDB_OPT_SET_ALL, false, "continue",'c', no_argument, NULL, 0, eArgTypeNone, "Immediately continue the process once attached."},
+{ LLDB_OPT_SET_ALL, false, "plugin", 'P', required_argument, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
+{ LLDB_OPT_SET_1, false, "pid", 'p', required_argument, NULL, 0, eArgTypePid, "The process ID of an existing process to attach to."},
+{ LLDB_OPT_SET_2, false, "name", 'n', required_argument, NULL, 0, eArgTypeProcessName, "The name of the process to attach to."},
+{ LLDB_OPT_SET_2, false, "waitfor", 'w', no_argument, NULL, 0, eArgTypeNone, "Wait for the the process with <process-name> to launch."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectWatchpoint.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectWatchpoint.cpp Thu May 24 05:13:48 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/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu May 24 05:13:48 2012
@@ -48,6 +48,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),
@@ -60,6 +61,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 (),
@@ -1286,6 +1288,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/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Thu May 24 05:13:48 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 ();
@@ -354,6 +357,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,
@@ -372,6 +376,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/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Thu May 24 05:13:48 2012
@@ -934,14 +934,10 @@
{
// For eax, ebx, ecx, edx, esi, edi, ebp, esp register mapping.
static const char* g_mapped_names[] = {
- "rax",
- "rbx",
- "rcx",
- "rdx",
- "rdi",
- "rsi",
- "rbp",
- "rsp"
+ "rax", "rbx", "rcx", "rdx", "rdi", "rsi", "rbp", "rsp",
+ "rax", "rbx", "rcx", "rdx", "rdi", "rsi", "rbp", "rsp",
+ "rax", "rbx", "rcx", "rdx",
+ "rax", "rbx", "rcx", "rdx", "rdi", "rsi", "rbp", "rsp"
};
// These value regs are to be populated with the corresponding primordial register index.
@@ -959,14 +955,34 @@
{
// NAME ALT SZ OFF ENCODING FORMAT COMPILER DWARF GENERIC GDB LLDB NATIVE VALUE REGS INVALIDATE REGS
// ====== ======= == === ============= ============ ===================== ===================== ============================ ==================== ====================== ========== ===============
- { "eax", NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_eax_regs, NULL},
+ { "eax" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_eax_regs, NULL},
{ "ebx" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebx_regs, NULL},
{ "ecx" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ecx_regs, NULL},
{ "edx" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edx_regs, NULL},
{ "edi" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edi_regs, NULL},
{ "esi" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esi_regs, NULL},
{ "ebp" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebp_regs, NULL},
- { "esp" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esp_regs, NULL}
+ { "esp" , NULL, 4, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esp_regs, NULL},
+ { "ax" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_eax_regs, NULL},
+ { "bx" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebx_regs, NULL},
+ { "cx" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ecx_regs, NULL},
+ { "dx" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edx_regs, NULL},
+ { "di" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edi_regs, NULL},
+ { "si" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esi_regs, NULL},
+ { "bp" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebp_regs, NULL},
+ { "sp" , NULL, 2, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esp_regs, NULL},
+ { "ah" , NULL, 1, 1, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_eax_regs, NULL},
+ { "bh" , NULL, 1, 1, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebx_regs, NULL},
+ { "ch" , NULL, 1, 1, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ecx_regs, NULL},
+ { "dh" , NULL, 1, 1, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edx_regs, NULL},
+ { "al" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_eax_regs, NULL},
+ { "bl" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebx_regs, NULL},
+ { "cl" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ecx_regs, NULL},
+ { "dl" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edx_regs, NULL},
+ { "dil" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_edi_regs, NULL},
+ { "sil" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esi_regs, NULL},
+ { "bpl" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_ebp_regs, NULL},
+ { "spl" , NULL, 1, 0, eEncodingUint , eFormatHex , { LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM , LLDB_INVALID_REGNUM }, g_esp_regs, NULL}
};
static const uint32_t num_conv_regs = llvm::array_lengthof(g_mapped_names);
Modified: lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu May 24 05:13:48 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/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu May 24 05:13:48 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/apple/python-GIL/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Thu May 24 05:13:48 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/apple/python-GIL/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu May 24 05:13:48 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/apple/python-GIL/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/Process.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/Process.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/Process.cpp Thu May 24 05:13:48 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/apple/python-GIL/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py Thu May 24 05:13:48 2012
@@ -18,6 +18,10 @@
system(["/bin/sh", "-c", "rm -f child_send.txt"])
system(["/bin/sh", "-c", "rm -f child_read.txt"])
+ def test_process_attach_dash_dash_con(self):
+ """Test that 'process attach --con' completes to 'process attach --continue '."""
+ self.complete_from_to('process attach --con', 'process attach --continue ')
+
# <rdar://problem/11052829>
def test_infinite_loop_while_completing(self):
"""Test that 'process print hello\' completes to itself and does not infinite loop."""
Modified: lldb/branches/apple/python-GIL/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/register/TestRegisters.py?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/register/TestRegisters.py Thu May 24 05:13:48 2012
@@ -1,5 +1,5 @@
"""
-Test the 'memory read' command.
+Test the 'register' command.
"""
import os, time
@@ -8,16 +8,24 @@
import lldb
from lldbtest import *
-class MemoryReadTestCase(TestBase):
+class RegisterCommandsTestCase(TestBase):
- mydir = os.path.join("functionalities", "memory", "read")
+ mydir = os.path.join("functionalities", "register")
- @unittest2.skipUnless(os.uname()[4] in ['x86_64'], "requires x86_64")
def test_register_commands(self):
"""Test commands related to registers, in particular xmm registers."""
+ if not self.getArchitecture() in ['i386', 'x86_64']:
+ self.skipTest("This test requires i386 or x86_64 as the architecture for the inferior")
self.buildDefault()
self.register_commands()
+ def test_convenience_registers(self):
+ """Test convenience registers."""
+ if not self.getArchitecture() in ['x86_64']:
+ self.skipTest("This test requires x86_64 as the architecture for the inferior")
+ self.buildDefault()
+ self.convenience_registers()
+
def register_commands(self):
"""Test commands related to registers, in particular xmm registers."""
exe = os.path.join(os.getcwd(), "a.out")
@@ -47,6 +55,32 @@
self.expect("expr (unsigned int)$xmm0[0]",
substrs = ['unsigned int'])
+ def convenience_registers(self):
+ """Test convenience registers."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break in main().
+ self.expect("breakpoint set -n main",
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: name = 'main'")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped', 'stop reason = breakpoint'])
+
+ # Test reading of rax and eax.
+ self.runCmd("register read rax eax")
+
+ # Now write rax with a unique bit pattern and test that eax indeed represents the lower half of rax.
+ self.runCmd("register write rax 0x1234567887654321")
+ self.expect("expr -- ($rax & 0xffffffff) == $eax",
+ substrs = ['true'])
+ self.expect("expr -- $ax == (($ah << 8) | $al)",
+ substrs = ['true'])
+
if __name__ == '__main__':
import atexit
Modified: lldb/branches/apple/python-GIL/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py Thu May 24 05:13:48 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/apple/python-GIL/test/python_api/default-constructor/sb_process.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/python_api/default-constructor/sb_process.py?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/python_api/default-constructor/sb_process.py (original)
+++ lldb/branches/apple/python-GIL/test/python_api/default-constructor/sb_process.py Thu May 24 05:13:48 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/apple/python-GIL/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/python_api/process/TestProcessAPI.py?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/branches/apple/python-GIL/test/python_api/process/TestProcessAPI.py Thu May 24 05:13:48 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)
@@ -310,6 +316,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/apple/python-GIL/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.cpp Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.h (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/DNB.h Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.cpp Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachProcess.h Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.cpp Thu May 24 05:13:48 2012
@@ -715,6 +715,12 @@
return false;
}
+uint32_t
+MachThread::NumSupportedHardwareWatchpoints () const
+{
+ return m_arch_ap->NumSupportedHardwareWatchpoints();
+}
+
bool
MachThread::GetIdentifierInfo ()
{
Modified: lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThread.h Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.cpp Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/MacOSX/MachThreadList.h Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.cpp?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.cpp Thu May 24 05:13:48 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/apple/python-GIL/tools/debugserver/source/RNBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.h?rev=157385&r1=157384&r2=157385&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.h (original)
+++ lldb/branches/apple/python-GIL/tools/debugserver/source/RNBRemote.h Thu May 24 05:13:48 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