[Lldb-commits] [lldb] r187270 - Document show args - settings show target.run-args

2013-07-26 Thread Jim Ingham
Author: jingham
Date: Fri Jul 26 18:20:05 2013
New Revision: 187270

URL: http://llvm.org/viewvc/llvm-project?rev=187270view=rev
Log:
Document show args - settings show target.run-args

Modified:
lldb/trunk/www/lldb-gdb.html

Modified: lldb/trunk/www/lldb-gdb.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/lldb-gdb.html?rev=187270r1=187269r2=187270view=diff
==
--- lldb/trunk/www/lldb-gdb.html (original)
+++ lldb/trunk/www/lldb-gdb.html Fri Jul 26 18:20:05 2013
@@ -80,6 +80,23 @@
 /td
 /tr
 
+trtd class=header colspan=2Or:/td/tr
+td class=content
+b(gdb)/b set args 1 2 3br
+b(gdb)/b runbr
+...br
+b(gdb)/b runbr
+...br
+/td
+td class=content
+b(lldb)/b settings set target.run-args 1 2 
3br
+b(lldb)/b runbr
+...br
+b(lldb)/b runbr
+...br
+/td
+/tr
+
 trtd class=header colspan=2Launch a process with 
arguments in new terminal window (Mac OS X only)./td/tr
 td class=content
 /td
@@ -109,6 +126,21 @@
 /td
 /tr
 
+trtd class=header colspan=2Show the arguments that 
will be or were passed to the program when run./td/tr
+td class=content
+b(gdb)/b show argsbr
+Argument list to give program being debugged when 
it is started is quot;1 2 3quot.br
+/td
+td class=content
+b(lldb)/b settings show target.run-argsbr
+target.run-args (array of strings) =br
+[0]: quot;1quot;br
+[1]: quot;2quot;br
+[2]: quot;3quot;br
+/td
+/tr
+
+
 trtd class=header colspan=2Set environment 
variables for process and launch process in one command./td/tr
 td class=content
 /td


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190023 - Remove spurious reference to radars in code (we try not to put Radar numbers into the sources.)

2013-09-04 Thread Jim Ingham
Author: jingham
Date: Wed Sep  4 20:48:56 2013
New Revision: 190023

URL: http://llvm.org/viewvc/llvm-project?rev=190023view=rev
Log:
Remove spurious reference to radars in code (we try not to put Radar numbers 
into the sources.)

Modified:
lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=190023r1=190022r2=190023view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Sep  4 20:48:56 2013
@@ -821,7 +821,6 @@ Debugger::GetSelectedExecutionContext ()
 }
 }
 return exe_ctx;
-
 }
 
 InputReaderSP 
@@ -1720,7 +1719,6 @@ FormatPromptRecurse
 do_deref_pointer = false;
 }
 
-// rdar://problem/11338654
 // we do not want to use the summary for a 
bitfield of type T:n
 // if we were originally dealing with just a T 
- that would get
 // us into an endless recursion


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190025 - Remove some unused #includes.

2013-09-04 Thread Jim Ingham
Author: jingham
Date: Wed Sep  4 20:51:15 2013
New Revision: 190025

URL: http://llvm.org/viewvc/llvm-project?rev=190025view=rev
Log:
Remove some unused #includes.

Modified:
lldb/trunk/source/Expression/DWARFExpression.cpp

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=190025r1=190024r2=190025view=diff
==
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Wed Sep  4 20:51:15 2013
@@ -32,10 +32,6 @@
 
 #include lldb/lldb-private-log.h
 
-#include lldb/Symbol/ClangASTType.h
-#include lldb/Symbol/ClangASTContext.h
-#include lldb/Symbol/Type.h
-
 #include lldb/Target/ABI.h
 #include lldb/Target/ExecutionContext.h
 #include lldb/Target/Process.h


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190026 - Remove an unused ivar.

2013-09-04 Thread Jim Ingham
Author: jingham
Date: Wed Sep  4 20:51:57 2013
New Revision: 190026

URL: http://llvm.org/viewvc/llvm-project?rev=190026view=rev
Log:
Remove an unused ivar.

Modified:
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/source/Expression/ClangFunction.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=190026r1=190025r2=190026view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Wed Sep  4 20:51:57 2013
@@ -624,7 +624,6 @@ private:
 Function   *m_function_ptr; /// The 
function we're going to call.  May be NULL if we don't have debug info for the 
function.
 Address m_function_addr;/// If we 
don't have the FunctionSP, we at least need the address  return type.
 ClangASTTypem_function_return_type; /// The 
opaque clang qual type for the function return type.
-ClangASTContext*m_clang_ast_context;/// This 
is the clang_ast_context that we're getting types from the and value, and the 
function return the function pointer is NULL.
 
 std::string m_wrapper_function_name;/// The 
name of the wrapper function.
 std::string m_wrapper_function_text;/// The 
contents of the wrapper function.

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=190026r1=190025r2=190026view=diff
==
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Wed Sep  4 20:51:57 2013
@@ -80,7 +80,6 @@ ClangFunction::ClangFunction
 m_function_ptr (function),
 m_function_addr (),
 m_function_return_type (),
-m_clang_ast_context (ast_context),
 m_wrapper_function_name (__lldb_function_caller),
 m_wrapper_struct_name (__lldb_caller_struct),
 m_wrapper_args_addrs (),


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190085 - Remove commented out routines.

2013-09-05 Thread Jim Ingham
Author: jingham
Date: Thu Sep  5 14:01:20 2013
New Revision: 190085

URL: http://llvm.org/viewvc/llvm-project?rev=190085view=rev
Log:
Remove commented out routines.

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=190085r1=190084r2=190085view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
 Thu Sep  5 14:01:20 2013
@@ -173,39 +173,6 @@ AppleObjCRuntimeV1::CreateObjectChecker(
 return new ClangUtilityFunction(buf-contents, name);
 }
 
-// this code relies on the assumption that an Objective-C object always starts
-// with an ISA at offset 0.
-//ObjCLanguageRuntime::ObjCISA
-//AppleObjCRuntimeV1::GetISA(ValueObject valobj)
-//{
-//ClangASTType valobj_clang_type = valobj.GetClangType();
-if (valobj_clang_type.GetMinimumLanguage() != eLanguageTypeObjC)
-return 0;
-//
-//// if we get an invalid VO (which might still happen when playing around
-//// with pointers returned by the expression parser, don't consider this
-//// a valid ObjC object)
-//if (!valobj.GetClangType().IsValid())
-//return 0;
-//
-//addr_t isa_pointer = valobj.GetPointerValue();
-//
-//ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-//
-//Process *process = exe_ctx.GetProcessPtr();
-//if (process)
-//{
-//uint8_t pointer_size = process-GetAddressByteSize();
-//
-//Error error;
-//return process-ReadUnsignedIntegerFromMemory (isa_pointer,
-//   pointer_size,
-//   0,
-//   error);
-//}
-//return 0;
-//}
-
 AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1 (ValueObject 
isa_pointer)
 {
 Initialize (isa_pointer.GetValueAsUnsigned(0),


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190084 - Include file cleanup.

2013-09-05 Thread Jim Ingham
Author: jingham
Date: Thu Sep  5 13:57:48 2013
New Revision: 190084

URL: http://llvm.org/viewvc/llvm-project?rev=190084view=rev
Log:
Include file cleanup.

Modified:
lldb/trunk/source/Core/Address.cpp

Modified: lldb/trunk/source/Core/Address.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=190084r1=190083r2=190084view=diff
==
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Thu Sep  5 13:57:48 2013
@@ -12,7 +12,6 @@
 #include lldb/Core/Section.h
 #include lldb/Symbol/Block.h
 #include lldb/Symbol/ObjectFile.h
-#include lldb/Symbol/Type.h
 #include lldb/Symbol/Variable.h
 #include lldb/Symbol/VariableList.h
 #include lldb/Target/ExecutionContext.h


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190172 - r189295 inadvertently set the codesigning identity for the debugserver Debug configuration

2013-09-06 Thread Jim Ingham
Author: jingham
Date: Fri Sep  6 11:54:45 2013
New Revision: 190172

URL: http://llvm.org/viewvc/llvm-project?rev=190172view=rev
Log:
r189295 inadvertently set the codesigning identity for the debugserver Debug 
configuration
to , which causes debugging to fail for that configuration.  Setting it back 
to lldb_codesign.

Modified:
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj

Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=190172r1=190171r2=190172view=diff
==
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj 
(original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Sep  
6 11:54:45 2013
@@ -606,7 +606,7 @@
CLANG_CXX_LIBRARY = libc++;
CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*] = 
source/debugserver-entitlements.plist;
CODE_SIGN_IDENTITY[sdk=iphoneos*] = -;
-   CODE_SIGN_IDENTITY[sdk=macosx*] = ;
+   CODE_SIGN_IDENTITY[sdk=macosx*] = 
lldb_codesign;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 310.99.0;
FRAMEWORK_SEARCH_PATHS = 
$SDKROOT/System/Library/PrivateFrameworks;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190380 - Change the breakpoint fuzz algorithm from coalesce the line ranges for a file line breakpoint if they are contiguous to

2013-09-09 Thread Jim Ingham
Author: jingham
Date: Mon Sep  9 21:06:17 2013
New Revision: 190380

URL: http://llvm.org/viewvc/llvm-project?rev=190380view=rev
Log:
Change the breakpoint fuzz algorithm from coalesce the line ranges for a 
file  line breakpoint if they are contiguous to 
coalesce the line ranges for a file  line breakpoint to the first range in 
each block.  We were still setting a silly number
of independent breakpoints sometimes, and until we get a compiler that emits 
trustworthy is_stmt flags in the line table, we
need to do something to reduce the noise.

rdar://problem/14920404

Modified:
lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=190380r1=190379r2=190380view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Mon Sep  9 
21:06:17 2013
@@ -140,21 +140,20 @@ BreakpointResolverFileLine::SearchCallba
 // Next go through and see if there are line table entries that are 
contiguous, and if so keep only the
 // first of the contiguous range:
 
-lldb::addr_t last_end_addr = LLDB_INVALID_ADDRESS;
 current_idx = 0;
+std::mapBlock *, lldb::addr_t blocks_with_breakpoints;
+
 while (current_idx  tmp_sc_list.GetSize())
 {
 if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
 {
-lldb::addr_t start_file_addr = 
sc.line_entry.range.GetBaseAddress().GetFileAddress();
-lldb::addr_t end_file_addr   = start_file_addr + 
sc.line_entry.range.GetByteSize();
-
-if (start_file_addr == last_end_addr)
+if (blocks_with_breakpoints.find (sc.block) != 
blocks_with_breakpoints.end())
 tmp_sc_list.RemoveContextAtIndex(current_idx);
 else
+{
+blocks_with_breakpoints.insert (std::pairBlock *, 
lldb::addr_t(sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress()));
 current_idx++;
-
-last_end_addr = end_file_addr;
+}
 }
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r190381 - Changing the default shell to /bin/sh brought up a long-standing bug on OS X,

2013-09-09 Thread Jim Ingham
Author: jingham
Date: Mon Sep  9 21:09:47 2013
New Revision: 190381

URL: http://llvm.org/viewvc/llvm-project?rev=190381view=rev
Log:
Changing the default shell to /bin/sh brought up a long-standing bug on OS X,
that /bin/sh re-exec's itself to /bin/bash, so it needs one more resume when you
are using it as the shell than /bin/bash did or you will stop at the start of 
your
program, rather than running it.

So I added a Platform API to get the number of resumes needed when launching 
with
a particular shell, and set the right values for Mac OS X.

rdar://problem/14935282

Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=190381r1=190380r2=190381view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Mon Sep  9 21:09:47 2013
@@ -726,6 +726,12 @@ namespace lldb_private {
 CalculateMD5 (const FileSpec file_spec,
   uint64_t low,
   uint64_t high);
+
+virtual int32_t
+GetResumeCountForShell (const char *shell)
+{
+return 1;
+}
 
 protected:
 bool m_is_host;

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=190381r1=190380r2=190381view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Sep  9 21:09:47 2013
@@ -786,7 +786,8 @@ public:
 ConvertArgumentsForLaunchingInShell (Error error,
  bool localhost,
  bool will_debug,
- bool first_arg_is_full_shell_command);
+ bool first_arg_is_full_shell_command,
+ int32_t num_resumes);
 
 void
 SetMonitorProcessCallback (Host::MonitorChildProcessCallback callback, 

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=190381r1=190380r2=190381view=diff
==
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Mon Sep  9 21:09:47 2013
@@ -1432,7 +1432,8 @@ Host::RunShellCommand (const char *comma
 launch_info.ConvertArgumentsForLaunchingInShell (error,
  localhost,
  will_debug,
- 
first_arg_is_full_shell_command);
+ 
first_arg_is_full_shell_command,
+ 0);
 }
 else
 {

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=190381r1=190380r2=190381view=diff
==
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Mon Sep  9 
21:09:47 2013
@@ -415,10 +415,12 @@ PlatformLinux::LaunchProcess (ProcessLau
 const bool is_localhost = true;
 const bool will_debug = 
launch_info.GetFlags().Test(eLaunchFlagDebug);
 const bool first_arg_is_full_shell_command = false;
+uint32_t num_resumes = GetResumeCountForShell 
(launch_info.GetShell());
 if (!launch_info.ConvertArgumentsForLaunchingInShell (error,
   is_localhost,
   will_debug,
-  
first_arg_is_full_shell_command))
+  
first_arg_is_full_shell_command,
+  num_resumes))
 return error;
 }
 error = Platform::LaunchProcess (launch_info);

Modified: 

[Lldb-commits] [lldb] r190538 - Turns out the number of times you need to resume the process for /bin/sh depends on the

2013-09-11 Thread Jim Ingham
Author: jingham
Date: Wed Sep 11 13:23:22 2013
New Revision: 190538

URL: http://llvm.org/viewvc/llvm-project?rev=190538view=rev
Log:
Turns out the number of times you need to resume the process for /bin/sh 
depends on the
setting of the environment variable COMMAND_MODE.  Changed the 
Platform::GetResumeCountForShell
to Platform::GetResumeCountForLaunchInfo, and check both the shell and in the 
case of
/bin/sh the environment as well.

Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=190538r1=190537r2=190538view=diff
==
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Wed Sep 11 13:23:22 2013
@@ -728,7 +728,7 @@ namespace lldb_private {
   uint64_t high);
 
 virtual int32_t
-GetResumeCountForShell (const char *shell)
+GetResumeCountForLaunchInfo (ProcessLaunchInfo launch_info)
 {
 return 1;
 }

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=190538r1=190537r2=190538view=diff
==
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Wed Sep 11 
13:23:22 2013
@@ -415,7 +415,7 @@ PlatformLinux::LaunchProcess (ProcessLau
 const bool is_localhost = true;
 const bool will_debug = 
launch_info.GetFlags().Test(eLaunchFlagDebug);
 const bool first_arg_is_full_shell_command = false;
-uint32_t num_resumes = GetResumeCountForShell 
(launch_info.GetShell());
+uint32_t num_resumes = GetResumeCountForLaunchInfo (launch_info);
 if (!launch_info.ConvertArgumentsForLaunchingInShell (error,
   is_localhost,
   will_debug,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=190538r1=190537r2=190538view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Sep 11 
13:23:22 2013
@@ -1226,8 +1226,12 @@ PlatformDarwin::GetEnvironment (StringLi
 }
 
 int32_t
-PlatformDarwin::GetResumeCountForShell (const char *shell)
+PlatformDarwin::GetResumeCountForLaunchInfo (ProcessLaunchInfo launch_info)
 {
+const char *shell = launch_info.GetShell();
+if (shell == NULL)
+return 1;
+
 const char *shell_name = strrchr (shell, '/');
 if (shell_name == NULL)
 shell_name = shell;
@@ -1237,7 +1241,18 @@ PlatformDarwin::GetResumeCountForShell (
 if (strcmp (shell_name, sh) == 0)
 {
 // /bin/sh re-exec's itself as /bin/bash requiring another resume.
-return 2;
+// But it only does this if the COMMAND_MODE environment variable
+// is set to legacy.
+char * const *envp = (char * 
const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector();
+if (envp != NULL)
+{
+for (int i = 0; envp[i] != NULL; i++)
+{
+if (strcmp (envp[i], COMMAND_MODE=legacy ) == 0)
+return 2;
+}
+}
+return 1;
 }
 else if (strcmp (shell_name, csh) == 0
 || strcmp (shell_name, tcsh) == 0

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=190538r1=190537r2=190538view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h Wed Sep 11 
13:23:22 2013
@@ -118,7 +118,7 @@ public:
 x86GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec 
arch);
 
 virtual int32_t
-GetResumeCountForShell (const char *shell);
+GetResumeCountForLaunchInfo (lldb_private::ProcessLaunchInfo launch_info);
 
 protected:
 virtual lldb_private::Error

Modified: lldb/trunk/source/Target/Platform.cpp
URL: 

[Lldb-commits] [lldb] r190734 - This changes how the --source driver argument works. I split this into four arguments:

2013-09-13 Thread Jim Ingham
Author: jingham
Date: Fri Sep 13 19:20:24 2013
New Revision: 190734

URL: http://llvm.org/viewvc/llvm-project?rev=190734view=rev
Log:
This changes how the --source driver argument works.  I split this into four 
arguments:

-S : Specifies a command file which will get sourced after the ~/.lldbinit but 
before file arguments are processed
-O : Specifies a single (one-line) command that will get ditto

and

-s : Specifies a command file which will get sourced after `pwd`/.lldbinit
-o : Specifies a command file which ditto

I also changed it so that by default these sourced commands will print their 
command result, but there's a
-q option to change that if you wish.

Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=190734r1=190733r2=190734view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 13 19:20:24 2013
@@ -99,13 +99,21 @@ static OptionDefinition g_options[] =
 extensions have been implemented. },
 { LLDB_3_TO_5,   false, debug  , 'd', no_argument  , 0,  
eArgTypeNone,
 Tells the debugger to print out extra information for debugging 
itself. },
+{ LLDB_3_TO_5,   false, source-quietly  , 'b', no_argument   
   , 0,  eArgTypeNone,
+Tells the debugger to print out extra information for debugging 
itself. },
 { LLDB_3_TO_5,   false, source , 's', required_argument, 0,  
eArgTypeFilename,
 Tells the debugger to read in and execute the file file, which 
should contain lldb commands. },
+{ LLDB_3_TO_5,   false, one-line , 'o', required_argument, 
0,  eArgTypeNone,
+Tells the debugger to execute this one-line lldb command. },
+{ LLDB_3_TO_5,   false, source-before-file , 'S', 
required_argument, 0,  eArgTypeFilename,
+Tells the debugger to read in and execute the file file, which 
should contain lldb commands. },
+{ LLDB_3_TO_5,   false, one-line-before-file , 'O', 
required_argument, 0,  eArgTypeNone,
+Tells the debugger to execute this one-line lldb command. },
 { LLDB_3_TO_5,   false, editor , 'e', no_argument  , 0,  
eArgTypeNone,
 Tells the debugger to open source files using the host's \external 
editor\ mechanism. },
 { LLDB_3_TO_5,   false, no-lldbinit, 'x', no_argument  , 0,  
eArgTypeNone,
 Do not automatically parse any '.lldbinit' files. },
-{ LLDB_3_TO_5,   false, no-use-colors  , 'o', no_argument  , 0,  
eArgTypeNone,
+{ LLDB_3_TO_5,   false, no-use-colors  , 'X', no_argument  , 0,  
eArgTypeNone,
 Do not use colors. },
 { LLDB_OPT_SET_6,true , python-path, 'P', no_argument  , 0,  
eArgTypeNone,
 Prints out the path to the lldb.py file for this version of lldb. },
@@ -390,8 +398,10 @@ Driver::OptionData::OptionData () :
 m_script_lang (lldb::eScriptLanguageDefault),
 m_core_file (),
 m_crash_log (),
-m_source_command_files (),
+m_initial_commands (),
+m_after_file_commands (),
 m_debug_mode (false),
+m_source_quietly(false),
 m_print_version (false),
 m_print_python_path (false),
 m_print_help (false),
@@ -412,8 +422,10 @@ Driver::OptionData::Clear ()
 {
 m_args.clear ();
 m_script_lang = lldb::eScriptLanguageDefault;
-m_source_command_files.clear ();
+m_initial_commands.clear ();
+m_after_file_commands.clear ();
 m_debug_mode = false;
+m_source_quietly = false;
 m_print_help = false;
 m_print_version = false;
 m_print_python_path = false;
@@ -424,6 +436,34 @@ Driver::OptionData::Clear ()
 }
 
 void
+Driver::OptionData::AddInitialCommand (const char *command, bool before_file, 
bool is_file, SBError error)
+{
+std::vectorstd::pairbool, std::string  *command_set;
+if (before_file)
+command_set = (m_initial_commands);
+else
+command_set = (m_after_file_commands);
+
+if (is_file)
+{
+SBFileSpec file(command);
+if (file.Exists())
+command_set-push_back (std::pairbool, std::string (true, 
optarg));
+else if (file.ResolveExecutableLocation())
+{
+char final_path[PATH_MAX];
+file.GetPath (final_path, sizeof(final_path));
+std::string path_str (final_path);
+command_set-push_back (std::pairbool, std::string (true, 
path_str));
+}
+else
+error.SetErrorStringWithFormat(file specified in --source (-s) 
option doesn't exist: '%s', optarg);
+}
+else
+command_set-push_back (std::pairbool, std::string (false, optarg));
+}
+
+void
 Driver::ResetOptionValues ()
 {
 m_option_data.Clear ();
@@ -451,18 +491,60 

[Lldb-commits] [lldb] r191478 - Factor the code that was eliminating redundant breakpoint locations and moving

2013-09-26 Thread Jim Ingham
Author: jingham
Date: Thu Sep 26 20:16:58 2013
New Revision: 191478

URL: http://llvm.org/viewvc/llvm-project?rev=191478view=rev
Log:
Factor the code that was eliminating redundant breakpoint locations and moving
line breakpoints past the prologue of functions so it can be shared between the
file  line breakpoint resolver, and the source pattern breakpoint resolver,
and then share it.

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=191478r1=191477r2=191478view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Thu Sep 26 20:16:58 
2013
@@ -134,6 +134,13 @@ public:
 }
 
 protected:
+//--
+/// SetSCMatchesByLine - Takes a symbol context list of matches which 
supposedly represent the same file and
+/// line number in a CU, and find the nearest actual line number that 
matches, and then filter down the
+/// matching addresses to unique entries, and skip the prologue if asked 
to do so, and then set
+/// breakpoint locations in this breakpoint for all the resultant 
addresses.
+void SetSCMatchesByLine (SearchFilter filter, SymbolContextList sc_list, 
bool skip_prologue, const char *log_ident);
+
 Breakpoint *m_breakpoint;  // This is the breakpoint we add locations to.
 
 private:

Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=191478r1=191477r2=191478view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Thu Sep 26 20:16:58 2013
@@ -23,9 +23,12 @@
 #include lldb/Core/StreamString.h
 #include lldb/Symbol/SymbolContext.h
 #include lldb/Target/Target.h
+#include lldb/Symbol/CompileUnit.h
+#include lldb/Symbol/Function.h
 #include lldb/lldb-private-log.h
 
 using namespace lldb_private;
+using namespace lldb;
 
 //--
 // BreakpointResolver:
@@ -59,3 +62,144 @@ BreakpointResolver::ResolveBreakpoint (S
 filter.Search (*this);
 }
 
+void
+BreakpointResolver::SetSCMatchesByLine (SearchFilter filter, 
SymbolContextList sc_list, bool skip_prologue, const char *log_ident)
+{
+Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+
+while (sc_list.GetSize()  0)
+{
+SymbolContextList tmp_sc_list;
+unsigned current_idx = 0;
+SymbolContext sc;
+bool first_entry = true;
+
+FileSpec match_file_spec;
+uint32_t closest_line_number = UINT32_MAX;
+
+// Pull out the first entry, and all the others that match its file 
spec, and stuff them in the tmp list.
+while (current_idx  sc_list.GetSize())
+{
+bool matches;
+
+sc_list.GetContextAtIndex (current_idx, sc);
+if (first_entry)
+{
+match_file_spec = sc.line_entry.file;
+matches = true;
+first_entry = false;
+}
+else
+matches = (sc.line_entry.file == match_file_spec);
+
+if (matches)
+{
+tmp_sc_list.Append (sc);
+sc_list.RemoveContextAtIndex(current_idx);
+
+// ResolveSymbolContext will always return a number that is = 
the line number you pass in.
+// So the smaller line number is always better.
+if (sc.line_entry.line  closest_line_number)
+closest_line_number = sc.line_entry.line;
+}
+else
+current_idx++;
+}
+
+// Okay, we've found the closest line number match, now throw away all 
the others:
+
+current_idx = 0;
+while (current_idx  tmp_sc_list.GetSize())
+{
+if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
+{
+if (sc.line_entry.line != closest_line_number)
+tmp_sc_list.RemoveContextAtIndex(current_idx);
+else
+current_idx++;
+}
+}
+
+// Next go through and see if there are line table entries that are 
contiguous, and if so keep only the
+// first of the contiguous 

[Lldb-commits] [lldb] r191556 - Convert ClangASTType::GetTypeName over to return a ConstString to be consistent with

2013-09-27 Thread Jim Ingham
Author: jingham
Date: Fri Sep 27 15:59:37 2013
New Revision: 191556

URL: http://llvm.org/viewvc/llvm-project?rev=191556view=rev
Log:
Convert ClangASTType::GetTypeName over to return a ConstString to be consistent 
with 
the other Get*TypeName functions.

Modified:
lldb/trunk/include/lldb/Symbol/ClangASTType.h
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=191556r1=191555r2=191556view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Fri Sep 27 15:59:37 2013
@@ -249,7 +249,7 @@ public:
 ConstString
 GetConstTypeName () const;
 
-std::string
+ConstString
 GetTypeName () const;
 
 uint32_t

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=191556r1=191555r2=191556view=diff
==
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Fri Sep 27 15:59:37 2013
@@ -111,7 +111,7 @@ ClangFunction::CompileFunction (Stream 
 // FIXME: How does clang tell us there's no return value?  We need to 
handle that case.
 unsigned num_errors = 0;
 
-std::string return_type_str (m_function_return_type.GetTypeName());
+std::string return_type_str 
(m_function_return_type.GetTypeName().AsCString());
 
 // Cons up the function we're going to wrap our call in, then compile it...
 // We declare the function extern C because the compiler might be in 
C++

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=191556r1=191555r2=191556view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Sep 27 
15:59:37 2013
@@ -2465,22 +2465,21 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
 
 if (class_language == eLanguageTypeObjC)
 {
-std::string class_str (clang_type.GetTypeName());
-if (!class_str.empty())
+ConstString class_name (clang_type.GetTypeName());
+if (class_name)
 {
 
 DIEArray method_die_offsets;
 if (m_using_apple_tables)
 {
 if (m_apple_objc_ap.get())
-
m_apple_objc_ap-FindByName(class_str.c_str(), method_die_offsets);
+
m_apple_objc_ap-FindByName(class_name.GetCString(), method_die_offsets);
 }
 else
 {
 if (!m_indexed)
 Index ();
 
-ConstString class_name (class_str.c_str());
 m_objc_class_selectors_index.Find (class_name, 
method_die_offsets);
 }
 
@@ -2502,7 +2501,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeD
 if (m_using_apple_tables)
 {
 
GetObjectFile()-GetModule()-ReportErrorIfModifyDetected (the DWARF debug 
information has been modified (.apple_objc accelerator table had bad die 
0x%8.8x for '%s')\n,
-   
die_offset, class_str.c_str());
+   
die_offset, class_name.GetCString());
 }
 }
 }

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=191556r1=191555r2=191556view=diff
==
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Sep 27 15:59:37 2013
@@ -1065,14 +1065,14 @@ 

[Lldb-commits] [lldb] r192518 - Report the summed hit count in the breakpoint line.

2013-10-11 Thread Jim Ingham
Author: jingham
Date: Fri Oct 11 19:40:02 2013
New Revision: 192518

URL: http://llvm.org/viewvc/llvm-project?rev=192518view=rev
Log:
Report the summed hit count in the breakpoint line.

rdar://problem/15183226

Modified:
lldb/trunk/source/Breakpoint/Breakpoint.cpp

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=192518r1=192517r2=192518view=diff
==
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Fri Oct 11 19:40:02 2013
@@ -559,7 +559,7 @@ Breakpoint::GetDescription (Stream *s, l
 {
 s-Printf(, locations = % PRIu64, (uint64_t)num_locations);
 if (num_resolved_locations  0)
-s-Printf(, resolved = % PRIu64, 
(uint64_t)num_resolved_locations);
+s-Printf(, resolved = % PRIu64 , hit count = %d, 
(uint64_t)num_resolved_locations, GetHitCount());
 }
 else
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r192987 - Make sure the CallFunction Thread plans don't try to do DoTakedown if their thread

2013-10-18 Thread Jim Ingham
Author: jingham
Date: Fri Oct 18 12:11:02 2013
New Revision: 192987

URL: http://llvm.org/viewvc/llvm-project?rev=192987view=rev
Log:
Make sure the CallFunction Thread plans don't try to do DoTakedown if their 
thread
has gone  away by the time they get around to doing it.

rdar://problem/15245544

Modified:
lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=192987r1=192986r2=192987view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Fri Oct 18 12:11:02 
2013
@@ -136,7 +136,13 @@ public:
 
 virtual bool
 RestoreThreadState();
-
+
+virtual void
+ThreadDestroyed ()
+{
+m_takedown_done = true;
+}
+
 protected:
 void ReportRegisterState (const char *message);
 

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=192987r1=192986r2=192987view=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Oct 18 12:11:02 2013
@@ -282,12 +282,18 @@ Thread::~Thread()
 void 
 Thread::DestroyThread ()
 {
-// Tell any plans on the plan stack that the thread is being destroyed 
since
-// any active plans that have a thread go away in the middle of might need
-// to do cleanup.
+// Tell any plans on the plan stacks that the thread is being destroyed 
since
+// any plans that have a thread go away in the middle of might need
+// to do cleanup, or in some cases NOT do cleanup...
 for (auto plan : m_plan_stack)
 plan-ThreadDestroyed();
 
+for (auto plan : m_discarded_plan_stack)
+plan-ThreadDestroyed();
+
+for (auto plan : m_completed_plan_stack)
+plan-ThreadDestroyed();
+
 m_destroy_called = true;
 m_plan_stack.clear();
 m_discarded_plan_stack.clear();


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r196197 - Remove the bad assumption that breakpoint locations won't get deleted in BreakpointLocationList::FindByID.

2013-12-02 Thread Jim Ingham
Author: jingham
Date: Mon Dec  2 20:31:17 2013
New Revision: 196197

URL: http://llvm.org/viewvc/llvm-project?rev=196197view=rev
Log:
Remove the bad assumption that breakpoint locations won't get deleted in 
BreakpointLocationList::FindByID.

rdar://problem/15566148

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=196197r1=196196r2=196197view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Mon Dec  2 
20:31:17 2013
@@ -260,7 +260,7 @@ protected:
  Address::ModulePointerAndOffsetLessThanFunctionObject 
addr_map;
 
 Breakpoint m_owner;
-collection m_locations;
+collection m_locations; // Vector of locations, sorted by ID 
 addr_map m_address_to_location;
 mutable Mutex m_mutex;
 lldb::break_id_t m_next_id;

Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=196197r1=196196r2=196197view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Mon Dec  2 20:31:17 
2013
@@ -77,19 +77,25 @@ BreakpointLocationList::FindIDByAddress
 return LLDB_INVALID_BREAK_ID;
 }
 
+static bool
+Compare (BreakpointLocationSP lhs, lldb::break_id_t val)
+{
+return lhs-GetID()  val;
+}
+
 BreakpointLocationSP
 BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
 {
 BreakpointLocationSP bp_loc_sp;
 Mutex::Locker locker (m_mutex);
-// We never remove a breakpoint locations, so the ID can be translated into
-// the location index by subtracting 1
-uint32_t idx = break_id - 1;
-if (idx = m_locations.size())
-{
-bp_loc_sp = m_locations[idx];
-}
-return bp_loc_sp;
+
+collection::const_iterator begin = m_locations.begin(), end = 
m_locations.end();
+collection::const_iterator result;
+result = std::lower_bound(begin, end, break_id, Compare);
+if (result == end)
+return bp_loc_sp;
+else
+return *(result);
 }
 
 size_t


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r196616 - Do a little more prevention against SBValues getting used after the world has been torn down around them.

2013-12-06 Thread Jim Ingham
Author: jingham
Date: Fri Dec  6 16:21:04 2013
New Revision: 196616

URL: http://llvm.org/viewvc/llvm-project?rev=196616view=rev
Log:
Do a little more prevention against SBValues getting used after the world has 
been torn down around them.

Modified:
lldb/trunk/source/API/SBValue.cpp

Modified: lldb/trunk/source/API/SBValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=196616r1=196615r2=196616view=diff
==
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Fri Dec  6 16:21:04 2013
@@ -96,7 +96,24 @@ public:
 bool
 IsValid ()
 {
-return m_valobj_sp.get() != NULL;
+if (m_valobj_sp.get() == NULL)
+return false;
+else
+{
+// FIXME: This check is necessary but not sufficient.  We for sure 
don't want to touch SBValues whose owning
+// targets have gone away.  This check is a little weak in that it 
enforces that restriction when you call
+// IsValid, but since IsValid doesn't lock the target, you have no 
guarantee that the SBValue won't go
+// invalid after you call this...
+// Also, an SBValue could depend on data from one of the modules 
in the target, and those could go away
+// independently of the target, for instance if a module is 
unloaded.  But right now, neither SBValues
+// nor ValueObjects know which modules they depend on.  So I have 
no good way to make that check without
+// tracking that in all the ValueObject subclasses.
+TargetSP target_sp = m_valobj_sp-GetTargetSP();
+if (target_sp  target_sp-IsValid())
+return true;
+else
+return false;
+}
 }
 
 lldb::ValueObjectSP
@@ -120,6 +137,8 @@ public:
 Target *target = value_sp-GetTargetSP().get();
 if (target)
 api_locker.Lock(target-GetAPIMutex());
+else
+return ValueObjectSP();
 
 ProcessSP process_sp(value_sp-GetProcessSP());
 if (process_sp  !stop_locker.TryLock (process_sp-GetRunLock()))
@@ -276,7 +295,7 @@ SBValue::IsValid ()
 // If this function ever changes to anything that does more than just
 // check if the opaque shared pointer is non NULL, then we need to update
 // all if (m_opaque_sp) code in this file.
-return m_opaque_sp.get() != NULL  m_opaque_sp-GetRootSP().get() != NULL;
+return m_opaque_sp.get() != NULL  m_opaque_sp-IsValid()  
m_opaque_sp-GetRootSP().get() != NULL;
 }
 
 void


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r196631 - If the StepThrough plan makes it back to the frame in which it started, it should say

2013-12-06 Thread Jim Ingham
Author: jingham
Date: Fri Dec  6 19:17:30 2013
New Revision: 196631

URL: http://llvm.org/viewvc/llvm-project?rev=196631view=rev
Log:
If the StepThrough plan makes it back to the frame in which it started, it 
should say
it succeeded, since the plan that was using it can figure out what to do from 
there.
It should only say it failed if it truely went off into the weeds.

rdar://problem/15597807

Modified:
lldb/trunk/source/Target/ThreadPlanStepThrough.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=196631r1=196630r2=196631view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Fri Dec  6 19:17:30 2013
@@ -161,7 +161,7 @@ ThreadPlanStepThrough::ShouldStop (Event
 // First, did we hit the backstop breakpoint?
 if (HitOurBackstopBreakpoint())
 {
-SetPlanComplete(false);
+SetPlanComplete(true);
 return true;
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r198881 - Document unsetting environment variables in the lldb/gdb cheat sheet.

2014-01-09 Thread Jim Ingham
Author: jingham
Date: Thu Jan  9 13:30:11 2014
New Revision: 198881

URL: http://llvm.org/viewvc/llvm-project?rev=198881view=rev
Log:
Document unsetting environment variables in the lldb/gdb cheat sheet.

Modified:
lldb/trunk/www/lldb-gdb.html

Modified: lldb/trunk/www/lldb-gdb.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/lldb-gdb.html?rev=198881r1=198880r2=198881view=diff
==
--- lldb/trunk/www/lldb-gdb.html (original)
+++ lldb/trunk/www/lldb-gdb.html Thu Jan  9 13:30:11 2014
@@ -126,6 +126,16 @@
 /td
 /tr
 
+trtd class=header colspan=2Unset environment 
variables for process before launching./td/tr
+td class=content
+b(gdb)/b unset env DEBUGbr
+/td
+td class=content
+b(lldb)/b settings remove target.env-vars 
DEBUGbr
+b(lldb)/b set rem target.env-vars DEBUGbr
+/td
+/tr
+
 trtd class=header colspan=2Show the arguments that 
will be or were passed to the program when run./td/tr
 td class=content
 b(gdb)/b show argsbr


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r198990 - Sometimes the trampoline refers directly to the indirect symbol. Handle that too.

2014-01-10 Thread Jim Ingham
Author: jingham
Date: Fri Jan 10 19:21:50 2014
New Revision: 198990

URL: http://llvm.org/viewvc/llvm-project?rev=198990view=rev
Log:
Sometimes the trampoline refers directly to the indirect symbol.  Handle that 
too.

Modified:

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=198990r1=198989r2=198990view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
Fri Jan 10 19:21:50 2014
@@ -1672,6 +1672,29 @@ DynamicLoaderMacOSXDYLD::GetStepThroughT
 }
 }
 }
+
+SymbolContextList indirect_symbols;
+images.FindSymbolsWithNameAndType(trampoline_name, 
eSymbolTypeResolver, indirect_symbols);
+size_t num_indirect_symbols = indirect_symbols.GetSize();
+if (num_indirect_symbols  0)
+{
+for (uint32_t i = 0; i  num_indirect_symbols; i++)
+{
+SymbolContext context;
+AddressRange addr_range;
+if (indirect_symbols.GetContextAtIndex(i, context))
+{
+context.GetAddressRange (eSymbolContextEverything, 
0, false, addr_range);
+addresses.push_back(addr_range.GetBaseAddress());
+if (log)
+{
+addr_t load_addr = 
addr_range.GetBaseAddress().GetLoadAddress(target_sp.get());
+
+log-Printf (Found an indirect target symbol 
at 0x% PRIx64 ., load_addr);
+}
+}
+}
+}
 }
 }
 else if (current_symbol-GetType() == eSymbolTypeReExported)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r199134 - This is a macosx specific test case for stepping setting breakpoints on indirect

2014-01-13 Thread Jim Ingham
Author: jingham
Date: Mon Jan 13 14:44:26 2014
New Revision: 199134

URL: http://llvm.org/viewvc/llvm-project?rev=199134view=rev
Log:
This is a macosx specific test case for stepping  setting breakpoints on 
indirect
and re-exported symbols.  I don't know if Linux has the latter, if it does, we 
could
probably make this a generic test.  Somebody who knows how to make these 
gadgets on 
Linux can maybe take a look...

Added:
lldb/trunk/test/macosx/indirect_symbol/
lldb/trunk/test/macosx/indirect_symbol/Makefile
lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py
lldb/trunk/test/macosx/indirect_symbol/alias.list
lldb/trunk/test/macosx/indirect_symbol/indirect.c
lldb/trunk/test/macosx/indirect_symbol/main.c
lldb/trunk/test/macosx/indirect_symbol/reexport.c

Added: lldb/trunk/test/macosx/indirect_symbol/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/Makefile?rev=199134view=auto
==
--- lldb/trunk/test/macosx/indirect_symbol/Makefile (added)
+++ lldb/trunk/test/macosx/indirect_symbol/Makefile Mon Jan 13 14:44:26 2014
@@ -0,0 +1,48 @@
+CC ?= clang
+ifeq $(ARCH) 
+   ARCH = x86_64
+endif
+
+ifeq $(OS) 
+   OS = $(shell uname -s)
+endif
+
+CFLAGS ?= -g -O0
+CWD := $(shell pwd)
+
+LIB_PREFIX := lib
+
+ifeq $(OS) Darwin
+   CFLAGS += -arch $(ARCH)
+   DS := dsymutil
+   LD_FLAGS := -dynamiclib
+   LIB_INDIRECT := $(LIB_PREFIX)indirect.dylib
+   LIB_REEXPORT := $(LIB_PREFIX)reexport.dylib
+   EXEC_PATH := @executable_path
+   EXEC_PATH_INDIRECT := -install_name $(EXEC_PATH)/$(LIB_INDIRECT)
+   EXEC_PATH_REEXPORT := -install_name $(EXEC_PATH)/$(LIB_REEXPORT)
+endif
+
+all: a.out $(LIB_INDIRECT) $(LIB_REEXPORT)
+
+a.out: main.o $(LIB_INDIRECT) $(LIB_REEXPORT)
+   $(CC) $(CFLAGS) -o a.out main.o -L. $(LIB_INDIRECT) $(LIB_REEXPORT)
+
+main.o: main.c
+   $(CC) $(CFLAGS) -c main.c
+
+$(LIB_INDIRECT): indirect.o
+   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_INDIRECT) -o $(LIB_INDIRECT) 
indirect.o
+   if [ $(OS) = Darwin ]; then dsymutil $(LIB_INDIRECT); fi
+
+indirect.o: indirect.c
+   $(CC) $(CFLAGS) -c indirect.c
+
+$(LIB_REEXPORT): reexport.o $(LIB_INDIRECT)
+   $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) 
reexport.o -L. -lindirect -Wl,-alias_list,$(CWD)/alias.list
+   if [ $(OS) = Darwin ]; then dsymutil $(LIB_REEXPORT); fi
+
+reexport.o: reexport.c
+   $(CC) $(CFLAGS) -c reexport.c
+clean:
+   rm -rf *.o *~ *.dylib *.so a.out *.dSYM

Added: lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py?rev=199134view=auto
==
--- lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py (added)
+++ lldb/trunk/test/macosx/indirect_symbol/TestIndirectSymbols.py Mon Jan 13 
14:44:26 2014
@@ -0,0 +1,106 @@
+Test stepping and setting breakpoints in indirect and re-exported 
symbols.
+
+import os, time
+import unittest2
+import lldb
+import lldbutil
+from lldbtest import *
+
+class TestObjCStepping(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@python_api_test
+@dsym_test
+def test_with_dsym_and_python_api(self):
+Test stepping and setting breakpoints in indirect and re-exported 
symbols.
+self.buildDsym()
+self.indirect_stepping()
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@python_api_test
+@dwarf_test
+def test_with_dwarf_and_python_api(self):
+Test stepping and setting breakpoints in indirect and re-exported 
symbols.
+self.buildDwarf()
+self.indirect_stepping()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line numbers that we will step to in main:
+self.main_source = main.c
+
+def indirect_stepping(self):
+Test stepping and setting breakpoints in indirect and re-exported 
symbols.
+exe = os.path.join(os.getcwd(), a.out)
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+self.main_source_spec = lldb.SBFileSpec (self.main_source)
+
+break1 = target.BreakpointCreateBySourceRegex (Set breakpoint here to 
step in indirect., self.main_source_spec)
+self.assertTrue(break1, VALID_BREAKPOINT)
+
+break2 = target.BreakpointCreateBySourceRegex (Set breakpoint here to 
step in reexported., self.main_source_spec)
+self.assertTrue(break2, VALID_BREAKPOINT)
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple (None, None, 
self.get_process_working_directory())
+
+

[Lldb-commits] [lldb] r199243 - Remove a compilation warning in the test case main.c file.

2014-01-14 Thread Jim Ingham
Author: jingham
Date: Tue Jan 14 12:46:15 2014
New Revision: 199243

URL: http://llvm.org/viewvc/llvm-project?rev=199243view=rev
Log:
Remove a compilation warning in the test case main.c file.

Modified:
lldb/trunk/test/macosx/indirect_symbol/main.c

Modified: lldb/trunk/test/macosx/indirect_symbol/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/indirect_symbol/main.c?rev=199243r1=199242r2=199243view=diff
==
--- lldb/trunk/test/macosx/indirect_symbol/main.c (original)
+++ lldb/trunk/test/macosx/indirect_symbol/main.c Tue Jan 14 12:46:15 2014
@@ -1,5 +1,5 @@
 extern int call_through_indirect(int);
-extern int call_through_reexport(int);
+extern int reexport_to_indirect(int);
 
 int
 main ()


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r199289 - Add a little more logging to the StopInfoBreakpoint::PerformAction.

2014-01-14 Thread Jim Ingham
Author: jingham
Date: Tue Jan 14 21:30:04 2014
New Revision: 199289

URL: http://llvm.org/viewvc/llvm-project?rev=199289view=rev
Log:
Add a little more logging to the StopInfoBreakpoint::PerformAction.

Modified:
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=199289r1=199288r2=199289view=diff
==
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Tue Jan 14 21:30:04 2014
@@ -419,8 +419,15 @@ protected:
 // The breakpoint site may have many locations 
associated with it, not all of them valid for
 // this thread.  Skip the ones that aren't:
 if (!bp_loc_sp-ValidForThisThread(thread_sp.get()))
+{
+if (log)
+{
+StreamString s;
+bp_loc_sp-GetDescription(s, 
eDescriptionLevelBrief);
+log-Printf (Breakpoint %s hit on thread 
0x%llx but it was not for this thread, continuing., s.GetData(), 
thread_sp-GetID());
+}
 continue;
-  
+}
 // First run the condition for the breakpoint.  If 
that says we should stop, then we'll run
 // the callback for the breakpoint.  If the callback 
says we shouldn't stop that will win.
 
@@ -450,6 +457,12 @@ protected:
 }
 else
 {
+if (log)
+{
+StreamString s;
+bp_loc_sp-GetDescription(s, 
eDescriptionLevelBrief);
+log-Printf (Condition evaluated for 
breakpoint %s on thread 0x%llx conditon_says_stop: %i., s.GetData(), 
thread_sp-GetID(), condition_says_stop);
+}
 if (!condition_says_stop)
 continue;
 }


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r199290 - Fix a bug where if we stop but nobody says there was a reason for the stop, we would return

2014-01-14 Thread Jim Ingham
Author: jingham
Date: Tue Jan 14 21:32:42 2014
New Revision: 199290

URL: http://llvm.org/viewvc/llvm-project?rev=199290view=rev
Log:
Fix a bug where if we stop but nobody says there was a reason for the stop, we 
would return
control to the user anyway.  This was put in to handle monitors that would say 
there was no
stop reason when you first attached to them.  But it broke the case where you 
hit a thread specific
breakpoint on many threads, but NOT the one specified in the breakpoint.  I 
work around this
by only doing the junky override when the StopID is 0 - i.e. on first attach.

This commit also adds a test for thread specific breakpoints.

Added:
lldb/trunk/test/functionalities/thread/thread_specific_break/
lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile

lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
lldb/trunk/test/functionalities/thread/thread_specific_break/main.c
Modified:
lldb/trunk/source/Target/ThreadList.cpp

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=199290r1=199289r2=199290view=diff
==
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Tue Jan 14 21:32:42 2014
@@ -293,17 +293,31 @@ ThreadList::ShouldStop (Event *event_ptr
 {
 ThreadSP thread_sp(*pos);
 
-did_anybody_stop_for_a_reason |= thread_sp-ThreadStoppedForAReason();
+// We should never get a stop for which no thread had a stop reason, 
but sometimes we do see this -
+// for instance when we first connect to a remote stub.  In that case 
we should stop, since we can't figure out
+// the right thing to do and stopping gives the user control over what 
to do in this instance.
+//
+// Note, this causes a problem when you have a thread specific 
breakpoint, and a bunch of threads hit the breakpoint,
+// but not the thread which we are waiting for.  All the threads that 
are not supposed to hit the breakpoint
+// are marked as having no stop reason, which is right, they should 
not show a stop reason.  But that triggers this
+// code and causes us to stop seemingly for no reason.
+//
+// Since the only way we ever saw this error was on first attach, I'm 
only going to trigger set did_anybody_stop_for_a_reason
+// to true unless this is the first stop.
+//
+// If this becomes a problem, we'll have to have another StopReason 
like StopInfoHidden which will look invalid
+// everywhere but at this check.
+
+if (thread_sp-GetProcess()-GetStopID() != 0)
+did_anybody_stop_for_a_reason = true;
+else
+did_anybody_stop_for_a_reason |= 
thread_sp-ThreadStoppedForAReason();
 
 const bool thread_should_stop = thread_sp-ShouldStop(event_ptr);
 if (thread_should_stop)
 should_stop |= true;
 }
 
-// We should never get a stop for which no thread had a stop reason, but 
sometimes we do see this -
-// for instance when we first connect to a remote stub.  In that case we 
should stop, since we can't figure out
-// the right thing to do and stopping gives the user control over what to 
do in this instance.
-
 if (!should_stop  !did_anybody_stop_for_a_reason)
 {
 should_stop = true;

Added: lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile?rev=199290view=auto
==
--- lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile 
(added)
+++ lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile Tue 
Jan 14 21:32:42 2014
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py?rev=199290view=auto
==
--- 
lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
 (added)
+++ 
lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
 Tue Jan 14 21:32:42 2014
@@ -0,0 +1,77 @@
+
+Test that we obey thread conditioned breakpoints.
+
+
+import os, time
+import re
+import unittest2
+import lldb, lldbutil
+from lldbtest import *
+
+class ThreadSpecificBreakTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+

[Lldb-commits] [lldb] r199509 - The default timeout for EvaluateExpressionOptions is not 0, so if no timeout is provided, we have to set the option timeout to 0 by hand.

2014-01-17 Thread Jim Ingham
Author: jingham
Date: Fri Jan 17 14:09:23 2014
New Revision: 199509

URL: http://llvm.org/viewvc/llvm-project?rev=199509view=rev
Log:
The default timeout for EvaluateExpressionOptions is not 0, so if no timeout is 
provided, we have to set the option timeout to 0 by hand.

rdar://problem/15846781

Modified:
lldb/trunk/source/Commands/CommandObjectExpression.cpp

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=199509r1=199508r2=199509view=diff
==
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jan 17 14:09:23 
2014
@@ -373,6 +373,8 @@ CommandObjectExpression::EvaluateExpress
 
 if (m_command_options.timeout  0)
 options.SetTimeoutUsec(m_command_options.timeout);
+else
+options.SetTimeoutUsec(0);
 
 exe_results = target-EvaluateExpression (expr, 
   exe_ctx.GetFramePtr(),


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r200878 - Fix the --source-quietly option to the driver so that it actually works. Clean up the help

2014-02-05 Thread Jim Ingham
Author: jingham
Date: Wed Feb  5 15:35:09 2014
New Revision: 200878

URL: http://llvm.org/viewvc/llvm-project?rev=200878view=rev
Log:
Fix the --source-quietly option to the driver so that it actually works.  Clean 
up the help
output a bit.

Modified:
lldb/trunk/tools/driver/Driver.cpp

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=200878r1=200877r2=200878view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Wed Feb  5 15:35:09 2014
@@ -82,20 +82,12 @@ static OptionDefinition g_options[] =
 Tells the debugger to use the file filename as the program to be 
debugged. },
 { LLDB_OPT_SET_3,false, core   , 'c', required_argument, 0,  
eArgTypeFilename,
 Tells the debugger to use the fullpath to path as the core file. },
+{ LLDB_OPT_SET_5,true , attach-pid , 'p', required_argument, 0,  
eArgTypePid,
+Tells the debugger to attach to a process with the given pid. },
 { LLDB_OPT_SET_4,true , attach-name, 'n', required_argument, 0,  
eArgTypeProcessName,
 Tells the debugger to attach to a process with the given name. },
 { LLDB_OPT_SET_4,true , wait-for   , 'w', no_argument  , 0,  
eArgTypeNone,
 Tells the debugger to wait for a process with the given pid or name 
to launch before attaching. },
-{ LLDB_OPT_SET_5,true , attach-pid , 'p', required_argument, 0,  
eArgTypePid,
-Tells the debugger to attach to a process with the given pid. },
-{ LLDB_3_TO_5,   false, script-language, 'l', required_argument, 0,  
eArgTypeScriptLang,
-Tells the debugger to use the specified scripting language for 
user-defined scripts, rather than the default.  
-Valid scripting languages that can be specified include Python, Perl, 
Ruby and Tcl.  Currently only the Python 
-extensions have been implemented. },
-{ LLDB_3_TO_5,   false, debug  , 'd', no_argument  , 0,  
eArgTypeNone,
-Tells the debugger to print out extra information for debugging 
itself. },
-{ LLDB_3_TO_5,   false, source-quietly  , 'b', no_argument   
   , 0,  eArgTypeNone,
-Tells the debugger to print out extra information for debugging 
itself. },
 { LLDB_3_TO_5,   false, source , 's', required_argument, 0,  
eArgTypeFilename,
 Tells the debugger to read in and execute the lldb commands in the 
given file, after any file provided on the command line has been loaded. },
 { LLDB_3_TO_5,   false, one-line , 'o', required_argument, 
0,  eArgTypeNone,
@@ -104,6 +96,8 @@ static OptionDefinition g_options[] =
 Tells the debugger to read in and execute the lldb commands in the 
given file, before any file provided on the command line has been loaded. },
 { LLDB_3_TO_5,   false, one-line-before-file , 'O', 
required_argument, 0,  eArgTypeNone,
 Tells the debugger to execute this one-line lldb command before any 
file provided on the command line has been loaded. },
+{ LLDB_3_TO_5,   false, source-quietly  , 'Q', no_argument   
   , 0,  eArgTypeNone,
+Tells the debugger suppress output from commands provided in the -s, 
-S, -O and -o commands. },
 { LLDB_3_TO_5,   false, editor , 'e', no_argument  , 0,  
eArgTypeNone,
 Tells the debugger to open source files using the host's \external 
editor\ mechanism. },
 { LLDB_3_TO_5,   false, no-lldbinit, 'x', no_argument  , 0,  
eArgTypeNone,
@@ -112,6 +106,12 @@ static OptionDefinition g_options[] =
 Do not use colors. },
 { LLDB_OPT_SET_6,true , python-path, 'P', no_argument  , 0,  
eArgTypeNone,
 Prints out the path to the lldb.py file for this version of lldb. },
+{ LLDB_3_TO_5,   false, script-language, 'l', required_argument, 0,  
eArgTypeScriptLang,
+Tells the debugger to use the specified scripting language for 
user-defined scripts, rather than the default.  
+Valid scripting languages that can be specified include Python, Perl, 
Ruby and Tcl.  Currently only the Python 
+extensions have been implemented. },
+{ LLDB_3_TO_5,   false, debug  , 'd', no_argument  , 0,  
eArgTypeNone,
+Tells the debugger to print out extra information for debugging 
itself. },
 { 0, false, NULL , 0  , 0, 0,  
eArgTypeNone, NULL }
 };
 
@@ -320,7 +320,11 @@ ShowUsage (FILE *out, OptionDefinition *
 }
 
 indent_level -= 5;
-
+
+fprintf (out, \n%*sNotes:\n,
+ indent_level, );
+indent_level += 5;
+
 fprintf (out, \n%*sMultiple \-s\ and \-o\ options can be provided.  
They will be processed from left to right in order, 
  

[Lldb-commits] [lldb] r202189 - Switch debugserver to detach on error by default, and change the flag to kill-on-error.

2014-02-25 Thread Jim Ingham
Author: jingham
Date: Tue Feb 25 13:57:47 2014
New Revision: 202189

URL: http://llvm.org/viewvc/llvm-project?rev=202189view=rev
Log:
Switch debugserver to detach on error by default, and change the flag to 
kill-on-error.
Also fix the bug where lldb prints: Got a connection and launched debugserver 
rather
than the name of the process it actually launched.

Modified:
lldb/trunk/tools/debugserver/source/debugserver.cpp

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=202189r1=202188r2=202189view=diff
==
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Tue Feb 25 13:57:47 2014
@@ -63,7 +63,7 @@ static nub_launch_flavor_t g_launch_flav
 int g_disable_aslr = 0;
 
 int g_isatty = 0;
-bool g_detach_on_error = false;
+bool g_detach_on_error = true;
 
 #define RNBLogSTDOUT(fmt, ...) do { if (g_isatty) { fprintf(stdout, fmt, ## 
__VA_ARGS__); } else { _DNBLog(0, fmt, ## __VA_ARGS__); } } while (0)
 #define RNBLogSTDERR(fmt, ...) do { if (g_isatty) { fprintf(stderr, fmt, ## 
__VA_ARGS__); } else { _DNBLog(0, fmt, ## __VA_ARGS__); } } while (0)
@@ -831,7 +831,7 @@ static struct option g_long_options[] =
 { attach, required_argument,  NULL,   'a' },
 { arch,   required_argument,  NULL,   'A' },
 { debug,  no_argument,NULL,   'g' },
-{ detach-on-error,no_argument,NULL,   'e' },
+{ kill-on-error,  no_argument,NULL,   'K' },
 { verbose,no_argument,NULL,   'v' },
 { lockdown,   no_argument,g_lockdown_opt,1   },  // 
short option -k
 { applist,no_argument,g_applist_opt, 1   },  // 
short option -t
@@ -1030,8 +1030,8 @@ main (int argc, char *argv[])
 }
 break;
 
-case 'e':
-g_detach_on_error = true;
+case 'K':
+g_detach_on_error = false;
 
 case 'W':
 if (optarg  optarg[0])
@@ -1536,7 +1536,12 @@ main (int argc, char *argv[])
 }
 
 if (mode != eRNBRunLoopModeExit)
-RNBLogSTDOUT (Got a connection, launched process 
%s.\n, argv_sub_zero);
+{
+const char *proc_name = unknown;
+if (ctx.ArgumentCount()  0)
+proc_name = ctx.ArgumentAtIndex(0);
+RNBLogSTDOUT (Got a connection, launched process 
%s (pid = %d).\n, proc_name, ctx.ProcessID());
+}
 }
 else
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r202426 - Check call to fgetc for EINTR.

2014-02-27 Thread Jim Ingham
Author: jingham
Date: Thu Feb 27 13:48:13 2014
New Revision: 202426

URL: http://llvm.org/viewvc/llvm-project?rev=202426view=rev
Log:
Check call to fgetc for EINTR.

rdar://problem/16140277

Modified:
lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=202426r1=202425r2=202426view=diff
==
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Thu Feb 27 13:48:13 2014
@@ -640,29 +640,40 @@ Editline::GetCharFromInputFileCallback (
 Editline *editline = GetClientData (e);
 if (editline  editline-m_got_eof == false)
 {
-char ch = ::fgetc(editline-GetInputFile());
-if (ch == '\x04')
+while (1)
 {
-// Only turn a CTRL+D into a EOF if we receive the
-// CTRL+D an empty line, otherwise it will forward
-// delete the character at the cursor
-const LineInfo *line_info = ::el_line(e);
-if (line_info != NULL 
-line_info-buffer == line_info-cursor 
-line_info-cursor == line_info-lastchar)
+errno = 0;
+char ch = ::fgetc(editline-GetInputFile());
+if (ch == '\x04')
 {
-ch = EOF;
+// Only turn a CTRL+D into a EOF if we receive the
+// CTRL+D an empty line, otherwise it will forward
+// delete the character at the cursor
+const LineInfo *line_info = ::el_line(e);
+if (line_info != NULL 
+line_info-buffer == line_info-cursor 
+line_info-cursor == line_info-lastchar)
+{
+ch = EOF;
+errno = 0;
+}
+}
+
+if (ch == EOF)
+{
+if (errno == EINTR)
+continue;
+else
+{
+editline-m_got_eof = true;
+break;
+}
+}
+else
+{
+*c = ch;
+return 1;
 }
-}
-
-if (ch == EOF)
-{
-editline-m_got_eof = true;
-}
-else
-{
-*c = ch;
-return 1;
 }
 }
 return 0;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r202464 - Plumb the EvaluateExpressionOptions::{Set, Get}StopOthers through the SB API, and make it work in RunThreadPlan.

2014-02-27 Thread Jim Ingham
Author: jingham
Date: Thu Feb 27 20:52:06 2014
New Revision: 202464

URL: http://llvm.org/viewvc/llvm-project?rev=202464view=rev
Log:
Plumb the EvaluateExpressionOptions::{Set,Get}StopOthers through the SB API, 
and make it work in RunThreadPlan.
Also remove SetStopOthers from the ThreadPlanCallFunction, because if the value 
you have doesn't match what is
in the EvaluateExpressionOptions the plan was passed when created it won't work 
correctly.

Modified:
lldb/trunk/include/lldb/API/SBExpressionOptions.h
lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
lldb/trunk/scripts/Python/interface/SBExpressionOptions.i
lldb/trunk/source/API/SBExpressionOptions.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=202464r1=202463r2=202464view=diff
==
--- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Thu Feb 27 20:52:06 2014
@@ -64,6 +64,12 @@ public:
 
 void
 SetTryAllThreads (bool run_others = true);
+
+bool
+GetStopOthers() const;
+
+void
+SetStopOthers(bool stop_others = true);
 
 bool
 GetTrapExceptions () const;

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=202464r1=202463r2=202464view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Thu Feb 27 20:52:06 
2014
@@ -52,9 +52,6 @@ public:
 virtual bool
 StopOthers ();
 
-virtual void
-SetStopOthers (bool new_value);
-
 virtual lldb::StateType
 GetPlanRunState ();
 

Modified: lldb/trunk/scripts/Python/interface/SBExpressionOptions.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBExpressionOptions.i?rev=202464r1=202463r2=202464view=diff
==
--- lldb/trunk/scripts/Python/interface/SBExpressionOptions.i (original)
+++ lldb/trunk/scripts/Python/interface/SBExpressionOptions.i Thu Feb 27 
20:52:06 2014
@@ -72,6 +72,13 @@ public:
 SetTryAllThreads (bool run_others = true);
 
 bool
+GetStopOthers () const;
+
+%feature(docstring, Sets whether to stop other threads at all while 
running expressins.  If false, TryAllThreads does nothing.) SetTryAllThreads;
+void
+SetStopOthers (bool stop_others = true);
+
+bool
 GetTrapExceptions () const;
 
 %feature(docstring, Sets whether to abort expression evaluation if an 
exception is thrown while executing.  Don't set this to false unless you know 
the function you are calling traps all exceptions itself.) SetTryAllThreads;

Modified: lldb/trunk/source/API/SBExpressionOptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBExpressionOptions.cpp?rev=202464r1=202463r2=202464view=diff
==
--- lldb/trunk/source/API/SBExpressionOptions.cpp (original)
+++ lldb/trunk/source/API/SBExpressionOptions.cpp Thu Feb 27 20:52:06 2014
@@ -114,6 +114,18 @@ SBExpressionOptions::SetTryAllThreads (b
 }
 
 bool
+SBExpressionOptions::GetStopOthers () const
+{
+return m_opaque_ap-GetStopOthers ();
+}
+
+void
+SBExpressionOptions::SetStopOthers (bool run_others)
+{
+m_opaque_ap-SetStopOthers (run_others);
+}
+
+bool
 SBExpressionOptions::GetTrapExceptions () const
 {
 return m_opaque_ap-GetTrapExceptions ();

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=202464r1=202463r2=202464view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Feb 27 20:52:06 2014
@@ -5118,7 +5118,12 @@ Process::RunThreadPlan (ExecutionContext
 TimeValue final_timeout = one_thread_timeout;
 
 uint32_t timeout_usec = options.GetTimeoutUsec();
-if (options.GetTryAllThreads())
+if (!options.GetStopOthers())
+{
+before_first_timeout = false;
+final_timeout.OffsetWithMicroSeconds(timeout_usec);
+}
+else if (options.GetTryAllThreads())
 {
 // If we are running all threads then we take half the time to run 
all threads, bounded by
 // .25 sec.

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: 

[Lldb-commits] [lldb] r202561 - Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

2014-02-28 Thread Jim Ingham
Author: jingham
Date: Fri Feb 28 18:17:06 2014
New Revision: 202561

URL: http://llvm.org/viewvc/llvm-project?rev=202561view=rev
Log:
Make sure the exe_ctx passed to ClangUserExpression::Execute has a valid thread.

rdar://problem/15949113

Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=202561r1=202560r2=202561view=diff
==
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Feb 28 18:17:06 
2014
@@ -763,6 +763,12 @@ ClangUserExpression::Execute (Stream er
 // expression, it's quite convenient to have these logs come out with the 
STEP log as well.
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | 
LIBLLDB_LOG_STEP));
 
+if (!exe_ctx.HasThreadScope())
+{
+error_stream.Printf(ClangUserExpression::Execute called with no 
thread selected.);
+return eExecutionSetupError;
+}
+
 if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret)
 {
 lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r202740 - Only require thread scope when we're about to run the function on a thread.

2014-03-03 Thread Jim Ingham
Author: jingham
Date: Mon Mar  3 13:16:45 2014
New Revision: 202740

URL: http://llvm.org/viewvc/llvm-project?rev=202740view=rev
Log:
Only require thread scope when we're about to run the function on a thread.

Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=202740r1=202739r2=202740view=diff
==
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Mar  3 13:16:45 
2014
@@ -763,12 +763,6 @@ ClangUserExpression::Execute (Stream er
 // expression, it's quite convenient to have these logs come out with the 
STEP log as well.
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | 
LIBLLDB_LOG_STEP));
 
-if (!exe_ctx.HasThreadScope()  !m_can_interpret)
-{
-error_stream.Printf(ClangUserExpression::Execute called with no 
thread selected.);
-return eExecutionSetupError;
-}
-
 if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret)
 {
 lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
@@ -829,6 +823,12 @@ ClangUserExpression::Execute (Stream er
 }
 else
 {
+if (!exe_ctx.HasThreadScope())
+{
+error_stream.Printf(ClangUserExpression::Execute called with 
no thread selected.);
+return eExecutionSetupError;
+}
+
 Address wrapper_address (m_jit_start_addr);
 
 llvm::SmallVector lldb::addr_t, 3 args;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r202782 - Fix a couple of typo's in breakpoint descriptions.

2014-03-03 Thread Jim Ingham
Author: jingham
Date: Mon Mar  3 21:09:00 2014
New Revision: 202782

URL: http://llvm.org/viewvc/llvm-project?rev=202782view=rev
Log:
Fix a couple of typo's in breakpoint descriptions.

Modified:
lldb/trunk/source/Breakpoint/Breakpoint.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=202782r1=202781r2=202782view=diff
==
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Mon Mar  3 21:09:00 2014
@@ -541,7 +541,7 @@ Breakpoint::GetDescription (Stream *s, l
 
 if (!m_kind_description.empty())
 {
-if (eDescriptionLevelBrief)
+if (level == eDescriptionLevelBrief)
 {
 s-PutCString (GetBreakpointKind());
 return;

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=202782r1=202781r2=202782view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Mon Mar  3 21:09:00 2014
@@ -626,7 +626,7 @@ BreakpointLocation::GetDescription (Stre
 if (exe_scope == NULL)
 exe_scope = target;
 
-if (eDescriptionLevelInitial)
+if (level == eDescriptionLevelInitial)
 m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, 
Address::DumpStyleFileAddress);
 else
 m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, 
Address::DumpStyleModuleWithFileAddress);


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r202956 - Add support for JIT debugging on Linux using the GDB JIT interface. Patch written with Keno Fischer.

2014-03-05 Thread Jim Ingham
This part of the patch worries me.  If I am debugging a process that doesn’t 
have this JIT loader symbol, this bit means every time that the process stops 
for any reason you will search the whole world for some symbol that won’t be 
found.  That’s something we really avoid doing if we can, programs get pretty 
big and this is not the sort of thing you want to do.

I don’t know how this symbol comes about, is there no event (shared library 
load or something) that you can hook into to find this symbol?

This patch is also causing a crash on Mac OS X just running a program.  The 
crash looks like:

(lldb) bt
* thread #8: tid = 0xf68e5, name = lldb.process.internal-state(pid=40372), 
function: lldb_private::Process::GetTarget() , stop reason = EXC_BAD_ACCESS 
(code=1, address=0x100)
frame #0: 0x000106f8072c LLDB`lldb_private::Process::GetTarget() at 
Process.h:2516
frame #1: 0x000108e7aa5a 
LLDB`JITLoaderGDB::GetSymbolAddress(lldb_private::ConstString const, 
lldb::SymbolType) const at JITLoaderGDB.cpp:368
frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
JITLoaderGDB.cpp:99
frame #3: 0x000108e7a6d8 
LLDB`JITLoaderGDB::ProcessStateChangedCallback(void*, lldb_private::Process*, 
lldb::StateType) at JITLoaderGDB.cpp:354
frame #4: 0x000108b7b29b 
LLDB`lldb_private::Process::SynchronouslyNotifyStateChanged(lldb::StateType) at 
Process.cpp:1223
frame #5: 0x000108b89762 
LLDB`lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) at 
Process.cpp:3846
frame #6: 0x000108b8454d 
LLDB`lldb_private::Process::HandlePrivateEvent(std::__1::shared_ptrlldb_private::Event)
 at Process.cpp:4141
frame #7: 0x000108b8a755 
LLDB`lldb_private::Process::RunPrivateStateThread() at Process.cpp:4290
frame #8: 0x000108b89bfd 
LLDB`lldb_private::Process::PrivateStateThread(void*) at Process.cpp:4221
frame #9: 0x0001087d811a LLDB`ThreadCreateTrampoline(void*) at 
Host.cpp:629
frame #10: 0x7fff815df899 libsystem_pthread.dylib`_pthread_body
frame #11: 0x7fff815df72a libsystem_pthread.dylib`_pthread_start
frame #12: 0x7fff815e3fc9 libsystem_pthread.dylib`thread_start
(lldb) f 2
frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
JITLoaderGDB.cpp:99
   96   log-Printf(JITLoaderGDB::%s looking for JIT register hook,
   97   __FUNCTION__);
   98   
- 99   addr_t jit_addr = 
GetSymbolAddress(ConstString(__jit_debug_register_code),
   100 eSymbolTypeAny);
   101  if (jit_addr == LLDB_INVALID_ADDRESS)
   102  return;
(lldb) expr *this
(JITLoaderGDB) $13 = {
  lldb_private::JITLoader = {
m_process = 0x Public: 
lldb_private::ThreadSafeValuelldb::StateType @  Private: 
lldb_private::ThreadSafeValuelldb::StateType @ 
  }
  m_jit_objects = size=160215376 {
[0] = {
  first = parent is NULL
  second = parent is NULL
}
...
  }
  m_jit_break_id = 0
  m_notification_callbacks = {
baton = 0x0001
initialize = 0x7fc54b00f3b0
process_state_changed = 0x0001098cb150 (vtable for 
std::__1::__shared_ptr_pointerlldb_private::Section*, 
std::__1::default_deletelldb_private::Section, 
std::__1::allocatorlldb_private::Section  + 16)
  }
}

Looks like the JIT instance that is getting passed in is not good for some 
reason.

Jim


On Mar 5, 2014, at 2:12 AM, Andrew MacPherson andrew.m...@gmail.com wrote:

 +void
 +JITLoaderGDB::ProcessStateChangedCallback(void *baton,
 +  lldb_private::Process *process,
 +  lldb::StateType state)
 +{
 +JITLoaderGDB* instance = static_castJITLoaderGDB*(baton);
 +
 +switch (state)
 +{
 +case eStateConnected:
 +case eStateAttaching:
 +case eStateLaunching:
 +case eStateInvalid:
 +case eStateUnloaded:
 +case eStateExited:
 +case eStateDetached:
 +// instance-Clear(false);
 +break;
 +
 +case eStateRunning:
 +case eStateStopped:
 +// Keep trying to set our JIT breakpoint each time we stop until we
 +// succeed
 +if (!instance-DidSetJITBreakpoint()  process-IsAlive())
 +instance-SetJITBreakpoint();
 +break;
 +
 +case eStateStepping:
 +case eStateCrashed:
 +case eStateSuspended:
 +break;
 +}
 +}
 +

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203068 - Temporarily disable the JIT loading detector till we figure out why it crashes when lldb follows through exec's...

2014-03-05 Thread Jim Ingham
Author: jingham
Date: Wed Mar  5 21:47:34 2014
New Revision: 203068

URL: http://llvm.org/viewvc/llvm-project?rev=203068view=rev
Log:
Temporarily disable the JIT loading detector till we figure out why it crashes 
when lldb follows through exec's...

Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=203068r1=203067r2=203068view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Mar  5 21:47:34 2014
@@ -3068,7 +3068,7 @@ Process::Launch (ProcessLaunchInfo laun
 if (dyld)
 dyld-DidLaunch();
 
-GetJITLoaders().DidLaunch();
+// GetJITLoaders().DidLaunch();
 
 SystemRuntime *system_runtime = GetSystemRuntime ();
 if (system_runtime)
@@ -3117,7 +3117,7 @@ Process::LoadCore ()
 if (dyld)
 dyld-DidAttach();
 
-GetJITLoaders().DidAttach();
+//GetJITLoaders().DidAttach();
 
 SystemRuntime *system_runtime = GetSystemRuntime ();
 if (system_runtime)
@@ -3396,7 +3396,7 @@ Process::CompleteAttach ()
 if (dyld)
 dyld-DidAttach();
 
-GetJITLoaders().DidAttach();
+// GetJITLoaders().DidAttach();
 
 SystemRuntime *system_runtime = GetSystemRuntime ();
 if (system_runtime)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r202956 - Add support for JIT debugging on Linux using the GDB JIT interface. Patch written with Keno Fischer.

2014-03-05 Thread Jim Ingham
So the crash is coming (on OS X) only in the case where you use:

(lldb) process launch —shell=/bin/bash —

which we implement (as does gdb) by consing up a command like:

/bin/bash exec PROGNAME arg1 arg2 …

and then running that.  So the program exec’s a few times before it gets to the 
executable we are actually trying to debug.  If I don’t do that but just run 
the program directly, then I don’t get this crash.

I temporarily disabled the calling of the GetJITLoader().Did{Attach,Launch} 
till we fix the crash.

Jim

On Mar 5, 2014, at 7:28 PM, Jim Ingham jing...@apple.com wrote:

 This part of the patch worries me.  If I am debugging a process that doesn’t 
 have this JIT loader symbol, this bit means every time that the process stops 
 for any reason you will search the whole world for some symbol that won’t be 
 found.  That’s something we really avoid doing if we can, programs get pretty 
 big and this is not the sort of thing you want to do.
 
 I don’t know how this symbol comes about, is there no event (shared library 
 load or something) that you can hook into to find this symbol?
 
 This patch is also causing a crash on Mac OS X just running a program.  The 
 crash looks like:
 
 (lldb) bt
 * thread #8: tid = 0xf68e5, name = lldb.process.internal-state(pid=40372), 
 function: lldb_private::Process::GetTarget() , stop reason = EXC_BAD_ACCESS 
 (code=1, address=0x100)
 frame #0: 0x000106f8072c LLDB`lldb_private::Process::GetTarget() at 
 Process.h:2516
 frame #1: 0x000108e7aa5a 
 LLDB`JITLoaderGDB::GetSymbolAddress(lldb_private::ConstString const, 
 lldb::SymbolType) const at JITLoaderGDB.cpp:368
 frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
 JITLoaderGDB.cpp:99
 frame #3: 0x000108e7a6d8 
 LLDB`JITLoaderGDB::ProcessStateChangedCallback(void*, lldb_private::Process*, 
 lldb::StateType) at JITLoaderGDB.cpp:354
 frame #4: 0x000108b7b29b 
 LLDB`lldb_private::Process::SynchronouslyNotifyStateChanged(lldb::StateType) 
 at Process.cpp:1223
 frame #5: 0x000108b89762 
 LLDB`lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) at 
 Process.cpp:3846
 frame #6: 0x000108b8454d 
 LLDB`lldb_private::Process::HandlePrivateEvent(std::__1::shared_ptrlldb_private::Event)
  at Process.cpp:4141
 frame #7: 0x000108b8a755 
 LLDB`lldb_private::Process::RunPrivateStateThread() at Process.cpp:4290
 frame #8: 0x000108b89bfd 
 LLDB`lldb_private::Process::PrivateStateThread(void*) at Process.cpp:4221
 frame #9: 0x0001087d811a LLDB`ThreadCreateTrampoline(void*) at 
 Host.cpp:629
 frame #10: 0x7fff815df899 libsystem_pthread.dylib`_pthread_body
 frame #11: 0x7fff815df72a libsystem_pthread.dylib`_pthread_start
 frame #12: 0x7fff815e3fc9 libsystem_pthread.dylib`thread_start
 (lldb) f 2
 frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
 JITLoaderGDB.cpp:99
96 log-Printf(JITLoaderGDB::%s looking for JIT register 
 hook,
97 __FUNCTION__);
98 
 - 99 addr_t jit_addr = 
 GetSymbolAddress(ConstString(__jit_debug_register_code),
100   eSymbolTypeAny);
101if (jit_addr == LLDB_INVALID_ADDRESS)
102return;
 (lldb) expr *this
 (JITLoaderGDB) $13 = {
   lldb_private::JITLoader = {
 m_process = 0x Public: 
 lldb_private::ThreadSafeValuelldb::StateType @  Private: 
 lldb_private::ThreadSafeValuelldb::StateType @ 
   }
   m_jit_objects = size=160215376 {
 [0] = {
   first = parent is NULL
   second = parent is NULL
 }
 ...
   }
   m_jit_break_id = 0
   m_notification_callbacks = {
 baton = 0x0001
 initialize = 0x7fc54b00f3b0
 process_state_changed = 0x0001098cb150 (vtable for 
 std::__1::__shared_ptr_pointerlldb_private::Section*, 
 std::__1::default_deletelldb_private::Section, 
 std::__1::allocatorlldb_private::Section  + 16)
   }
 }
 
 Looks like the JIT instance that is getting passed in is not good for some 
 reason.
 
 Jim
 
 
 On Mar 5, 2014, at 2:12 AM, Andrew MacPherson andrew.m...@gmail.com wrote:
 
 +void
 +JITLoaderGDB::ProcessStateChangedCallback(void *baton,
 +  lldb_private::Process *process,
 +  lldb::StateType state)
 +{
 +JITLoaderGDB* instance = static_castJITLoaderGDB*(baton);
 +
 +switch (state)
 +{
 +case eStateConnected:
 +case eStateAttaching:
 +case eStateLaunching:
 +case eStateInvalid:
 +case eStateUnloaded:
 +case eStateExited:
 +case eStateDetached:
 +// instance-Clear(false);
 +break;
 +
 +case eStateRunning:
 +case eStateStopped:
 +// Keep trying to set our JIT breakpoint each time we stop until we
 +// succeed
 +if (!instance-DidSetJITBreakpoint()  process-IsAlive

Re: [Lldb-commits] [lldb] r202956 - Add support for JIT debugging on Linux using the GDB JIT interface. Patch written with Keno Fischer.

2014-03-05 Thread Jim Ingham
BTW, I realize this was a kind of incoherent message.  I was looking at the 
patch and wrote the first and last sections, then played with it and saw the 
crash, and interleaved the two messages…  Sorry ‘bout that, my only defense is 
that I was waiting for the Pizza to arrive…

Jim

On Mar 5, 2014, at 7:28 PM, Jim Ingham jing...@apple.com wrote:

 This part of the patch worries me.  If I am debugging a process that doesn’t 
 have this JIT loader symbol, this bit means every time that the process stops 
 for any reason you will search the whole world for some symbol that won’t be 
 found.  That’s something we really avoid doing if we can, programs get pretty 
 big and this is not the sort of thing you want to do.
 
 I don’t know how this symbol comes about, is there no event (shared library 
 load or something) that you can hook into to find this symbol?
 
 This patch is also causing a crash on Mac OS X just running a program.  The 
 crash looks like:
 
 (lldb) bt
 * thread #8: tid = 0xf68e5, name = lldb.process.internal-state(pid=40372), 
 function: lldb_private::Process::GetTarget() , stop reason = EXC_BAD_ACCESS 
 (code=1, address=0x100)
 frame #0: 0x000106f8072c LLDB`lldb_private::Process::GetTarget() at 
 Process.h:2516
 frame #1: 0x000108e7aa5a 
 LLDB`JITLoaderGDB::GetSymbolAddress(lldb_private::ConstString const, 
 lldb::SymbolType) const at JITLoaderGDB.cpp:368
 frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
 JITLoaderGDB.cpp:99
 frame #3: 0x000108e7a6d8 
 LLDB`JITLoaderGDB::ProcessStateChangedCallback(void*, lldb_private::Process*, 
 lldb::StateType) at JITLoaderGDB.cpp:354
 frame #4: 0x000108b7b29b 
 LLDB`lldb_private::Process::SynchronouslyNotifyStateChanged(lldb::StateType) 
 at Process.cpp:1223
 frame #5: 0x000108b89762 
 LLDB`lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) at 
 Process.cpp:3846
 frame #6: 0x000108b8454d 
 LLDB`lldb_private::Process::HandlePrivateEvent(std::__1::shared_ptrlldb_private::Event)
  at Process.cpp:4141
 frame #7: 0x000108b8a755 
 LLDB`lldb_private::Process::RunPrivateStateThread() at Process.cpp:4290
 frame #8: 0x000108b89bfd 
 LLDB`lldb_private::Process::PrivateStateThread(void*) at Process.cpp:4221
 frame #9: 0x0001087d811a LLDB`ThreadCreateTrampoline(void*) at 
 Host.cpp:629
 frame #10: 0x7fff815df899 libsystem_pthread.dylib`_pthread_body
 frame #11: 0x7fff815df72a libsystem_pthread.dylib`_pthread_start
 frame #12: 0x7fff815e3fc9 libsystem_pthread.dylib`thread_start
 (lldb) f 2
 frame #2: 0x000108e7a8bf LLDB`JITLoaderGDB::SetJITBreakpoint() at 
 JITLoaderGDB.cpp:99
96 log-Printf(JITLoaderGDB::%s looking for JIT register 
 hook,
97 __FUNCTION__);
98 
 - 99 addr_t jit_addr = 
 GetSymbolAddress(ConstString(__jit_debug_register_code),
100   eSymbolTypeAny);
101if (jit_addr == LLDB_INVALID_ADDRESS)
102return;
 (lldb) expr *this
 (JITLoaderGDB) $13 = {
   lldb_private::JITLoader = {
 m_process = 0x Public: 
 lldb_private::ThreadSafeValuelldb::StateType @  Private: 
 lldb_private::ThreadSafeValuelldb::StateType @ 
   }
   m_jit_objects = size=160215376 {
 [0] = {
   first = parent is NULL
   second = parent is NULL
 }
 ...
   }
   m_jit_break_id = 0
   m_notification_callbacks = {
 baton = 0x0001
 initialize = 0x7fc54b00f3b0
 process_state_changed = 0x0001098cb150 (vtable for 
 std::__1::__shared_ptr_pointerlldb_private::Section*, 
 std::__1::default_deletelldb_private::Section, 
 std::__1::allocatorlldb_private::Section  + 16)
   }
 }
 
 Looks like the JIT instance that is getting passed in is not good for some 
 reason.
 
 Jim
 
 
 On Mar 5, 2014, at 2:12 AM, Andrew MacPherson andrew.m...@gmail.com wrote:
 
 +void
 +JITLoaderGDB::ProcessStateChangedCallback(void *baton,
 +  lldb_private::Process *process,
 +  lldb::StateType state)
 +{
 +JITLoaderGDB* instance = static_castJITLoaderGDB*(baton);
 +
 +switch (state)
 +{
 +case eStateConnected:
 +case eStateAttaching:
 +case eStateLaunching:
 +case eStateInvalid:
 +case eStateUnloaded:
 +case eStateExited:
 +case eStateDetached:
 +// instance-Clear(false);
 +break;
 +
 +case eStateRunning:
 +case eStateStopped:
 +// Keep trying to set our JIT breakpoint each time we stop until we
 +// succeed
 +if (!instance-DidSetJITBreakpoint()  process-IsAlive())
 +instance-SetJITBreakpoint();
 +break;
 +
 +case eStateStepping:
 +case eStateCrashed:
 +case eStateSuspended:
 +break;
 +}
 +}
 +
 
 ___
 lldb

[Lldb-commits] [lldb] r203231 - The ThreadPlanCallFunction needs to pass its StopOthers to its run to address subplan.

2014-03-07 Thread Jim Ingham
Author: jingham
Date: Fri Mar  7 05:16:37 2014
New Revision: 203231

URL: http://llvm.org/viewvc/llvm-project?rev=203231view=rev
Log:
The ThreadPlanCallFunction needs to pass its StopOthers to its run to address 
subplan.

Modified:
lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=203231r1=203230r2=203231view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Fri Mar  7 05:16:37 
2014
@@ -125,7 +125,10 @@ public:
 m_takedown_done = true;
 }
 
-protected:
+virtual void
+SetStopOthers (bool new_value);
+
+protected:
 void ReportRegisterState (const char *message);
 
 virtual bool

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=203231r1=203230r2=203231view=diff
==
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Mar  7 05:16:37 2014
@@ -536,6 +536,13 @@ ThreadPlanCallFunction::BreakpointsExpla
 return false;
 }
 
+void
+ThreadPlanCallFunction::SetStopOthers (bool new_value)
+{
+m_subplan_sp-SetStopOthers(new_value);
+}
+
+
 bool
 ThreadPlanCallFunction::RestoreThreadState()
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r203591 - After doing all the work to compute the target ValueObject we want to evaluate, make sure

2014-03-11 Thread Jim Ingham
Author: jingham
Date: Tue Mar 11 13:17:23 2014
New Revision: 203591

URL: http://llvm.org/viewvc/llvm-project?rev=203591view=rev
Log:
After doing all the work to compute the target ValueObject we want to evaluate, 
make sure
we actually got something before proceeding.

rdar://problem/16282875

Modified:
lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=203591r1=203590r2=203591view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Mar 11 13:17:23 2014
@@ -1682,6 +1682,13 @@ FormatPromptRecurse
 do_deref_pointer = false;
 }
 
+if (!target)
+{
+if (log)
+log-Printf([Debugger::FormatPrompt] 
could not calculate target for prompt expression);
+break;
+}
+
 // we do not want to use the summary for a 
bitfield of type T:n
 // if we were originally dealing with just a T 
- that would get
 // us into an endless recursion


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204087 - Get ThreadPlanShouldStopHere to handle auto-stepping through line number 0 code.

2014-03-17 Thread Jim Ingham
Author: jingham
Date: Mon Mar 17 18:03:34 2014
New Revision: 204087

URL: http://llvm.org/viewvc/llvm-project?rev=204087view=rev
Log:
Get ThreadPlanShouldStopHere to handle auto-stepping through line number 0 
code.

Modified:
lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp

Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=204087r1=204086r2=204087view=diff
==
--- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Mon Mar 17 18:03:34 
2014
@@ -76,6 +76,9 @@ ThreadPlanShouldStopHere::DefaultShouldS
 {
 bool should_stop_here = true;
 StackFrame *frame = 
current_plan-GetThread().GetStackFrameAtIndex(0).get();
+if (!frame)
+return true;
+
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
 if ((operation == eFrameCompareOlder  flags.Test(eStepOutAvoidNoDebug))
@@ -90,6 +93,17 @@ ThreadPlanShouldStopHere::DefaultShouldS
 }
 }
 
+// Always avoid code with line number 0.
+// FIXME: At present the ShouldStop and the StepFromHere calculate this 
independently.  If this ever
+// becomes expensive (this one isn't) we can try to have this set a state 
that the StepFromHere can use.
+if (frame)
+{
+SymbolContext sc;
+sc = frame-GetSymbolContext (eSymbolContextLineEntry);
+if (sc.line_entry.line == 0)
+should_stop_here = false;
+}
+
 return should_stop_here;
 }
 
@@ -99,16 +113,35 @@ ThreadPlanShouldStopHere::DefaultStepFro
  FrameComparison 
operation,
  void *baton)
 {
-const bool stop_others = false;
-const size_t frame_index = 0;
-ThreadPlanSP return_plan_sp = 
current_plan-GetThread().QueueThreadPlanForStepOutNoShouldStop (false,
-   
   NULL,
-   
   true,
-   
   stop_others,
-   
   eVoteNo,
-   
   eVoteNoOpinion,
-   
   frame_index);
+const bool stop_others = false;
+const size_t frame_index = 0;
+ThreadPlanSP return_plan_sp;
+// If we are stepping through code at line number 0, then we need to step 
over this range.  Otherwise
+// we will step out.
+StackFrame *frame = 
current_plan-GetThread().GetStackFrameAtIndex(0).get();
+if (!frame)
 return return_plan_sp;
+SymbolContext sc;
+sc = frame-GetSymbolContext (eSymbolContextLineEntry);
+if (sc.line_entry.line == 0)
+{
+AddressRange range = sc.line_entry.range;
+return_plan_sp = 
current_plan-GetThread().QueueThreadPlanForStepOverRange(false,
+   
range,
+   
sc,
+   
eOnlyDuringStepping,
+   
eLazyBoolNo);
+}
+
+if (!return_plan_sp)
+return_plan_sp = 
current_plan-GetThread().QueueThreadPlanForStepOutNoShouldStop (false,
+   
   NULL,
+   
   true,
+   
   stop_others,
+   
   eVoteNo,
+   
   eVoteNoOpinion,
+   
   frame_index);
+return return_plan_sp;
 }
 
 ThreadPlanSP


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204206 - Expected failure printing std::string::c_str() due to flubbing the typedef lookup.

2014-03-18 Thread Jim Ingham
Author: jingham
Date: Tue Mar 18 19:30:31 2014
New Revision: 204206

URL: http://llvm.org/viewvc/llvm-project?rev=204206view=rev
Log:
Expected failure printing std::string::c_str() due to flubbing the typedef 
lookup.

Modified:

lldb/trunk/test/expression_command/call-function/TestCallStdStringFunction.py

Modified: 
lldb/trunk/test/expression_command/call-function/TestCallStdStringFunction.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-function/TestCallStdStringFunction.py?rev=204206r1=204205r2=204206view=diff
==
--- 
lldb/trunk/test/expression_command/call-function/TestCallStdStringFunction.py 
(original)
+++ 
lldb/trunk/test/expression_command/call-function/TestCallStdStringFunction.py 
Tue Mar 18 19:30:31 2014
@@ -20,6 +20,7 @@ class ExprCommandCallFunctionTestCase(Te
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @dsym_test
+@expectedFailureDarwin(16361880) # rdar://problem/16361880, we get the 
result correctly, but fail to invoke the Summary formatter.
 def test_with_dsym(self):
 Test calling std::String member function.
 self.buildDsym()
@@ -29,6 +30,7 @@ class ExprCommandCallFunctionTestCase(Te
 @expectedFailureFreeBSD('llvm.org/pr17807') # Fails on FreeBSD buildbot
 @expectedFailureGcc # llvm.org/pr14437, fails with GCC 4.6.3 and 4.7.2
 @expectedFailureIcc # llvm.org/pr14437, fails with ICC 13.1
+@expectedFailureDarwin(16361880) # rdar://problem/16361880, we get the 
result correctly, but fail to invoke the Summary formatter.
 def test_with_dwarf(self):
 Test calling std::String member function.
 self.buildDwarf()
@@ -46,12 +48,8 @@ class ExprCommandCallFunctionTestCase(Te
 self.expect(print str,
 substrs = ['Hello world'])
 
-# Should be fixed with r142717.
-#
-# rdar://problem/9471744 test failure: ./dotest.py -C clang -v -w -t 
-p CallStdString
-# runCmd: print str.c_str()
-# runCmd failed!
-# error: Couldn't convert the expression to DWARF
+# Calling this function now succeeds, but we follow the typedef return 
type through to
+# const char *, and thus don't invoke the Summary formatter.
 self.expect(print str.c_str(),
 substrs = ['Hello world'])
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204208 - Don't use the Disassembly test to report the fact that we don't decorate up

2014-03-18 Thread Jim Ingham
Author: jingham
Date: Tue Mar 18 20:41:19 2014
New Revision: 204208

URL: http://llvm.org/viewvc/llvm-project?rev=204208view=rev
Log:
Don't use the Disassembly test to report the fact that we don't decorate up
constructors with their class name, that seems inessential.  We can make another
test specifically for this if we want to.

Modified:
lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py

Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py?rev=204208r1=204207r2=204208view=diff
==
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py Tue Mar 
18 20:41:19 2014
@@ -57,18 +57,21 @@ class IterateFrameAndDisassembleTestCase
 self.runCmd(file  + exe, CURRENT_EXECUTABLE_SET)
 
 # Break on the ctor function of class C.
-lldbutil.run_break_set_by_file_and_line (self, main.cpp, self.line, 
num_expected_locations=-1)
+bpno = lldbutil.run_break_set_by_file_and_line (self, main.cpp, 
self.line, num_expected_locations=-1)
 
 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'])
+   'stop reason = breakpoint %d.'%(bpno)])
 
+# This test was failing because we fail to put the C:: in front of 
constructore.
+# We should maybe make another testcase to cover that specifically, 
but we shouldn't
+# fail this whole testcase for an inessential issue.
 # We should be stopped on the ctor function of class C.
-self.expect(thread backtrace, BACKTRACE_DISPLAYED_CORRECTLY,
-substrs = ['C::C'])
+# self.expect(thread backtrace, BACKTRACE_DISPLAYED_CORRECTLY,
+#  substrs = ['C::C'])
 
 def disassemble_call_stack(self):
 Disassemble each call frame when stopped on C's constructor.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204209 - Add a test to check the C's constructor's name is C::C, which will fail everywhere now,

2014-03-18 Thread Jim Ingham
Author: jingham
Date: Tue Mar 18 20:54:41 2014
New Revision: 204209

URL: http://llvm.org/viewvc/llvm-project?rev=204209view=rev
Log:
Add a test to check the C's constructor's name is C::C, which will fail 
everywhere now,
so mark as expected fail.  And find another way to check that we hit our 
constructor
breakpoint, so we don't need to expected fail the Disassembly tests.

Modified:
lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py

Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py?rev=204209r1=204208r2=204209view=diff
==
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py Tue Mar 18 20:54:41 
2014
@@ -10,6 +10,7 @@ import lldbutil
 class ClassTypesTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
+failing_compilers = ['clang', 'gcc']
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @dsym_test
@@ -59,6 +60,27 @@ class ClassTypesTestCase(TestBase):
 self.buildDwarf()
 self.class_types_expr_parser()
 
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+# rdar://problem/8557478
+# test/class_types test failures: runCmd: expr this-m_c_int
+@dsym_test
+@expectedFailureDarwin(16362674)
+def test_with_dsym_and_constructor_name(self):
+Test 'frame variable this' and 'expr this' when stopped inside a 
constructor.
+self.buildDsym()
+self.class_types_constructor_name()
+
+# rdar://problem/8557478
+# test/class_types test failures: runCmd: expr this-m_c_int
+@dwarf_test
+@expectedFailureFreeBSD('llvm.org/pr14540')
+@expectedFailureLinux('llvm.org/pr14540', failing_compilers)
+@expectedFailureDarwin(16362674)
+def test_with_dwarf_and_constructor_name (self):
+Test 'frame variable this' and 'expr this' when stopped inside a 
constructor.
+self.buildDwarf()
+self.class_types_constructor_name()
+
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
@@ -206,6 +228,55 @@ class ClassTypesTestCase(TestBase):
 patterns = ['\(int\) \$[0-9]+ = 66'])
 
 
+def class_types_constructor_name (self):
+Check whether the constructor name has the class name prepended.
+exe = os.path.join(os.getcwd(), a.out)
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+filespec = target.GetExecutable()
+self.assertTrue(filespec, VALID_FILESPEC)
+
+fsDir = filespec.GetDirectory()
+fsFile = filespec.GetFilename()
+
+self.assertTrue(fsDir == os.getcwd() and fsFile == a.out,
+FileSpec matches the executable)
+
+bpfilespec = lldb.SBFileSpec(main.cpp, False)
+
+breakpoint = target.BreakpointCreateByLocation(bpfilespec, self.line)
+self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+# Verify the breakpoint just created.
+self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
+substrs = ['main.cpp',
+   str(self.line)])
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple (None, None, 
self.get_process_working_directory())
+
+if not process:
+self.fail(SBTarget.Launch() failed)
+
+if process.GetState() != lldb.eStateStopped:
+self.fail(Process should be in the 'stopped' state, 
+  instead the actual state is: '%s' %
+  lldbutil.state_type_to_str(process.GetState()))
+
+# The stop reason of the thread should be breakpoint.
+thread = process.GetThreadAtIndex(0)
+if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
+from lldbutil import stop_reason_to_str
+self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
+  stop_reason_to_str(thread.GetStopReason()))
+
+frame = thread.frames[0]
+self.assertTrue (frame.IsValid(), Got a valid frame.)
+
+self.assertTrue (C::C in frame.name, Constructor name includes 
class name.)
+
 if __name__ == '__main__':
 import atexit
 lldb.SBDebugger.Initialize()

Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py?rev=204209r1=204208r2=204209view=diff
==
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py Tue Mar 
18 

[Lldb-commits] [lldb] r204281 - Remove unnecessary dependence on vecLib.

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 18:25:11 2014
New Revision: 204281

URL: http://llvm.org/viewvc/llvm-project?rev=204281view=rev
Log:
Remove unnecessary dependence on vecLib.

Modified:
lldb/trunk/test/functionalities/data-formatter/rdar-10642615/Makefile
lldb/trunk/test/functionalities/data-formatter/rdar-10642615/main.cpp

Modified: lldb/trunk/test/functionalities/data-formatter/rdar-10642615/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10642615/Makefile?rev=204281r1=204280r2=204281view=diff
==
--- lldb/trunk/test/functionalities/data-formatter/rdar-10642615/Makefile 
(original)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10642615/Makefile Wed 
Mar 19 18:25:11 2014
@@ -4,4 +4,4 @@ CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
 
-LDFLAGS += -framework Accelerate -framework vecLib
\ No newline at end of file
+LDFLAGS += -framework Accelerate
\ No newline at end of file

Modified: lldb/trunk/test/functionalities/data-formatter/rdar-10642615/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10642615/main.cpp?rev=204281r1=204280r2=204281view=diff
==
--- lldb/trunk/test/functionalities/data-formatter/rdar-10642615/main.cpp 
(original)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10642615/main.cpp Wed 
Mar 19 18:25:11 2014
@@ -8,7 +8,6 @@
 
//===--===//
 
 #include Accelerate/Accelerate.h
-#include vecLib/vecLibTypes.h
 
 int main()
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204282 - Remember to run ranlib after ar to make useful archive files.

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 18:38:22 2014
New Revision: 204282

URL: http://llvm.org/viewvc/llvm-project?rev=204282view=rev
Log:
Remember to run ranlib after ar to make useful archive files.

Modified:
lldb/trunk/test/functionalities/fat_archives/Makefile

Modified: lldb/trunk/test/functionalities/fat_archives/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/fat_archives/Makefile?rev=204282r1=204281r2=204282view=diff
==
--- lldb/trunk/test/functionalities/fat_archives/Makefile (original)
+++ lldb/trunk/test/functionalities/fat_archives/Makefile Wed Mar 19 18:38:22 
2014
@@ -1,8 +1,10 @@
 all: clean
$(CC) -arch i386 -g -c a.c
ar -q liba-i386.a a.o
+   ranlib liba-i386.a
$(CC) -arch x86_64 -g -c a.c
ar -q liba-x86_64.a a.o
+   ranlib liba-x86_64.a
lipo -create -output liba.a liba-i386.a liba-x86_64.a
$(CC) -g -c main.c
$(CC) -o a.out main.o -L. -la


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204283 - These logging tests depend on the exact output of lldb logging, which is brittle

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 18:50:48 2014
New Revision: 204283

URL: http://llvm.org/viewvc/llvm-project?rev=204283view=rev
Log:
These logging tests depend on the exact output of lldb logging, which is brittle
and not particularly useful.  Skipping till we get a chance to make a test that 
actually tests something we care about.

Modified:
lldb/trunk/test/logging/TestLogging.py

Modified: lldb/trunk/test/logging/TestLogging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/TestLogging.py?rev=204283r1=204282r2=204283view=diff
==
--- lldb/trunk/test/logging/TestLogging.py (original)
+++ lldb/trunk/test/logging/TestLogging.py Wed Mar 19 18:50:48 2014
@@ -14,11 +14,13 @@ class LogTestCase(TestBase):
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @dsym_test
 def test_with_dsym (self):
+self.skipTest (This test case depends on the exact output of lldb 
log.  Why is that useful?)
 self.buildDsym ()
 self.command_log_tests (dsym)
 
 @dwarf_test
 def test_with_dwarf (self):
+self.skipTest (This test case depends on the exact output of lldb 
log.  Why is that useful?)
 self.buildDwarf ()
 self.command_log_tests (dwarf)
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204284 - I changed the logging test to just test that logging doesn't crash and does produce output. That's

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 18:55:54 2014
New Revision: 204284

URL: http://llvm.org/viewvc/llvm-project?rev=204284view=rev
Log:
I changed the logging test to just test that logging doesn't crash and does 
produce output.  That's 
about all it is useful to test.

Modified:
lldb/trunk/test/logging/TestLogging.py

Modified: lldb/trunk/test/logging/TestLogging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/logging/TestLogging.py?rev=204284r1=204283r2=204284view=diff
==
--- lldb/trunk/test/logging/TestLogging.py (original)
+++ lldb/trunk/test/logging/TestLogging.py Wed Mar 19 18:55:54 2014
@@ -1,5 +1,5 @@
 
-Test lldb logging.
+Test lldb logging.  This test just makes sure logging doesn't crash, and 
produces some output.
 
 
 import os, time
@@ -14,13 +14,11 @@ class LogTestCase(TestBase):
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @dsym_test
 def test_with_dsym (self):
-self.skipTest (This test case depends on the exact output of lldb 
log.  Why is that useful?)
 self.buildDsym ()
 self.command_log_tests (dsym)
 
 @dwarf_test
 def test_with_dwarf (self):
-self.skipTest (This test case depends on the exact output of lldb 
log.  Why is that useful?)
 self.buildDwarf ()
 self.command_log_tests (dwarf)
 
@@ -47,59 +45,16 @@ class LogTestCase(TestBase):
 
 self.runCmd (bp l)
 
-expected_log_lines = [
-Processing command: command alias bp breakpoint\n,
-HandleCommand, cmd_obj : 'command alias'\n,
-HandleCommand, revised_command_line: 'command alias bp 
breakpoint'\n,
-HandleCommand, wants_raw_input:'True'\n,
-HandleCommand, command line after removing command name(s): 'bp 
breakpoint'\n,
-HandleCommand, command succeeded\n,
-Processing command: bp set -n main\n,
-HandleCommand, cmd_obj : 'breakpoint set'\n,
-HandleCommand, revised_command_line: 'breakpoint set -n main'\n,
-HandleCommand, wants_raw_input:'False'\n,
-HandleCommand, command line after removing command name(s): '-n 
main'\n,
-HandleCommand, command succeeded\n,
-Processing command: bp l\n,
-HandleCommand, cmd_obj : 'breakpoint list'\n,
-HandleCommand, revised_command_line: 'breakpoint l'\n,
-HandleCommand, wants_raw_input:'False'\n,
-HandleCommand, command line after removing command name(s): ''\n,
-HandleCommand, command succeeded\n,
-Processing command: log disable lldb\n,
-HandleCommand, cmd_obj : 'log disable'\n,
-HandleCommand, revised_command_line: 'log disable lldb'\n,
-HandleCommand, wants_raw_input:'False'\n,
-HandleCommand, command line after removing command name(s): 
'lldb'\n,
-]
-
 self.runCmd(log disable lldb)
 
 self.assertTrue (os.path.isfile (log_file))
 
-idx = 0
-end = len (expected_log_lines)
 f = open (log_file)
 log_lines = f.readlines()
 f.close ()
 os.remove (log_file)
 
-err_msg = 
-success = True
-
-if len (log_lines) != len (expected_log_lines):
-success = False
-err_msg = Wrong number of lines in log file; expected:  + repr 
(len (expected_log_lines)) +  found:  + repr(len (log_lines))
-else:
-for line1, line2 in zip (log_lines, expected_log_lines):
-if line1 != line2:
-success = False
-err_msg = Expected ' + line2 + '; Found ' + line1 + '
-break
-
-if not success:
-self.fail (err_msg)
-
+self.assertTrue(log_lines  0, Something was written to the log 
file.)
 
 if __name__ == '__main__':
 import atexit


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204287 - expectedFailureDarwin for this test case.

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 19:19:16 2014
New Revision: 204287

URL: http://llvm.org/viewvc/llvm-project?rev=204287view=rev
Log:
expectedFailureDarwin for this test case.

Modified:
lldb/trunk/test/expression_command/po_verbosity/TestPoVerbosity.py

Modified: lldb/trunk/test/expression_command/po_verbosity/TestPoVerbosity.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/po_verbosity/TestPoVerbosity.py?rev=204287r1=204286r2=204287view=diff
==
--- lldb/trunk/test/expression_command/po_verbosity/TestPoVerbosity.py 
(original)
+++ lldb/trunk/test/expression_command/po_verbosity/TestPoVerbosity.py Wed Mar 
19 19:19:16 2014
@@ -20,6 +20,7 @@ class PoVerbosityTestCase(TestBase):
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @dsym_test
+@expectedFailureDarwin(16374063)
 def test_with_dsym(self):
 Test that the po command acts correctly.
 self.buildDsym()
@@ -27,6 +28,7 @@ class PoVerbosityTestCase(TestBase):
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin 
due to ObjC test case)
 @dwarf_test
+@expectedFailureDarwin(16374063)
 def test_with_dwarf(self):
 Test that the po command acts correctly.
 self.buildDwarf()


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204288 - More recent compilers emit debug info for the length property of NSString, so the length will be correctly

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 20:08:27 2014
New Revision: 204288

URL: http://llvm.org/viewvc/llvm-project?rev=204288view=rev
Log:
More recent compilers emit debug info for the length property of NSString, so 
the length will be correctly
reported as NSUInteger.  Adopt the test case to handle either possibility.

Modified:
lldb/trunk/test/lang/objc/foundation/TestRuntimeTypes.py

Modified: lldb/trunk/test/lang/objc/foundation/TestRuntimeTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/foundation/TestRuntimeTypes.py?rev=204288r1=204287r2=204288view=diff
==
--- lldb/trunk/test/lang/objc/foundation/TestRuntimeTypes.py (original)
+++ lldb/trunk/test/lang/objc/foundation/TestRuntimeTypes.py Wed Mar 19 
20:08:27 2014
@@ -46,7 +46,7 @@ class RuntimeTypesTestCase(TestBase):
 
 # The length property should be usable.
 self.expect(expression str.length, VARIABLES_DISPLAYED_CORRECTLY,
-substrs = [(unsigned long long)])
+patterns = [r(\(unsigned long long\))|\(NSUInteger\)])
 
 # Static methods on NSString should work.
 self.expect(expr [NSString stringWithCString:\foo\ encoding:1], 
VALID_TYPE,


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204295 - Adapt test to avoid short string types.

2014-03-19 Thread Jim Ingham
Author: jingham
Date: Wed Mar 19 21:21:17 2014
New Revision: 204295

URL: http://llvm.org/viewvc/llvm-project?rev=204295view=rev
Log:
Adapt test to avoid short string types.

Modified:

lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py

Modified: 
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=204295r1=204294r2=204295view=diff
==
--- 
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 (original)
+++ 
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
 Wed Mar 19 21:21:17 2014
@@ -370,7 +370,7 @@ class ObjCDataFormatterTestCase(TestBase
 def nsstring_data_formatter_commands(self):
 self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 
str9 str10 str11 label1 label2 processName str12',
 substrs = ['(NSString *) str1 = ',' @A rather short ASCII 
NSString object is here',
-'(NSString *) str0 = ',' @255',
+# '(NSString *) str0 = ',' @255',
 '(NSString *) str1 = ',' @A rather short ASCII NSString 
object is here',
 '(NSString *) str2 = ',' @A rather short UTF8 NSString 
object is here',
 '(NSString *) str3 = ',' @A string made with the at sign 
is here',
@@ -527,20 +527,20 @@ class ObjCDataFormatterTestCase(TestBase
 
 # check that the formatters are able to deal safely and correctly
 # with ValueObjects that the expression parser returns
-self.expect('expression ((id)@Hello)', matching=False,
-substrs = ['Hello'])
+self.expect('expression ((id)@Hello for long enough to avoid short 
string types)', matching=False,
+substrs = ['Hello for long enough to avoid short string 
types'])
 
-self.expect('expression -d run -- ((id)@Hello)',
-substrs = ['Hello'])
+self.expect('expression -d run -- ((id)@Hello for long enough to 
avoid short string types)',
+substrs = ['Hello for long enough to avoid short string types'])
 
 self.expect('expr -d run -- label1',
 substrs = ['Process Name'])
 
-self.expect('expr -d run -- @Hello',
-substrs = ['Hello'])
+self.expect('expr -d run -- @Hello for long enough to avoid short 
string types',
+substrs = ['Hello for long enough to avoid short string types'])
 
-self.expect('expr -d run --object-description -- @Hello',
-substrs = ['Hello'])
+self.expect('expr -d run --object-description -- @Hello for long 
enough to avoid short string types',
+substrs = ['Hello for long enough to avoid short string types'])
 self.expect('expr -d run --object-description -- @Hello', 
matching=False,
 substrs = ['@Hello Hello'])
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r204359 - Guard against reading from host address of 0 in getting the data from a Value.

2014-03-20 Thread Jim Ingham
Author: jingham
Date: Thu Mar 20 12:13:28 2014
New Revision: 204359

URL: http://llvm.org/viewvc/llvm-project?rev=204359view=rev
Log:
Guard against reading from host address of 0 in getting the data from a Value.

Modified:
lldb/trunk/source/Core/Value.cpp

Modified: lldb/trunk/source/Core/Value.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=204359r1=204358r2=204359view=diff
==
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Thu Mar 20 12:13:28 2014
@@ -579,7 +579,12 @@ Value::GetValueAsData (ExecutionContext
 {
 if (address_type == eAddressTypeHost)
 {
-// The address is an address in this process, so just copy it
+// The address is an address in this process, so just copy it.
+if (address == 0)
+{
+error.SetErrorStringWithFormat(trying to read from host 
address of 0.);
+return error;
+}
 memcpy (dst, (uint8_t*)NULL + address, byte_size);
 }
 else if ((address_type == eAddressTypeLoad) || (address_type == 
eAddressTypeFile))


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205381 - Test case for the previous commit.

2014-04-01 Thread Jim Ingham
Author: jingham
Date: Tue Apr  1 20:05:27 2014
New Revision: 205381

URL: http://llvm.org/viewvc/llvm-project?rev=205381view=rev
Log:
Test case for the previous commit.

Added:

lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py

Added: 
lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py?rev=205381view=auto
==
--- 
lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
 (added)
+++ 
lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
 Tue Apr  1 20:05:27 2014
@@ -0,0 +1,88 @@
+
+Test that you can set breakpoint commands successfully with the Python API's:
+
+
+import os
+import re
+import unittest2
+import lldb, lldbutil
+import sys
+from lldbtest import *
+
+class PythonBreakpointCommandSettingTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+my_var = 10
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@python_api_test
+@dsym_test
+def test_step_out_with_dsym_python(self):
+Test stepping out using avoid-no-debug with dsyms.
+self.buildDsym()
+self.do_set_python_command_from_python()
+
+@python_api_test
+@dwarf_test
+def test_step_out_with_dwarf_python(self):
+Test stepping out using avoid-no-debug with dsyms.
+self.buildDwarf()
+self.do_set_python_command_from_python ()
+
+def setUp (self):
+TestBase.setUp(self)
+self.main_source = main.c
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+
+
+def do_set_python_command_from_python (self):
+exe = os.path.join(os.getcwd(), a.out)
+error = lldb.SBError()
+
+self.target = self.dbg.CreateTarget(exe)
+self.assertTrue(self.target, VALID_TARGET)
+
+body_bkpt = self.target.BreakpointCreateBySourceRegex(Set break point 
at this line., self.main_source_spec)
+self.assertTrue(body_bkpt, VALID_BREAKPOINT)
+
+func_bkpt = self.target.BreakpointCreateBySourceRegex(Set break point 
at this line., self.main_source_spec)
+self.assertTrue(func_bkpt, VALID_BREAKPOINT)
+
+PythonBreakpointCommandSettingTestCase.my_var = 10
+error = lldb.SBError()
+error = body_bkpt.SetScriptCallbackBody(\
+import TestBreakpointCommandsFromPython\n\
+TestBreakpointCommandsFromPython.PythonBreakpointCommandSettingTestCase.my_var 
= 20\n\
+print 'Hit breakpoint')
+self.assertTrue (error.Success(), Failed to set the script callback 
body: %s.%(error.GetCString()))
+
+self.dbg.HandleCommand(command script import --allow-reload 
./bktptcmd.py)
+func_bkpt.SetScriptCallbackFunction(bktptcmd.function)
+
+# We will use the function that touches a text file, so remove it 
first:
+self.RemoveTempFile(output2.txt)
+
+# Now launch the process, and do not stop at entry point.
+self.process = self.target.LaunchSimple (None, None, 
self.get_process_working_directory())
+
+self.assertTrue(self.process, PROCESS_IS_VALID)
+
+# Now finish, and make sure the return value is correct.
+threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, 
body_bkpt)
+self.assertTrue(len(threads) == 1, Stopped at inner breakpoint.)
+self.thread = threads[0]
+
+self.assertTrue(PythonBreakpointCommandSettingTestCase.my_var == 20)
+
+# Check for the function version as well, which produced this file:
+# Remember to clean up after ourselves...
+self.assertTrue(os.path.isfile(output2.txt),
+'output2.txt' exists due to breakpoint command for 
breakpoint function.)
+self.RemoveTempFile(output2.txt)
+
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205380 - Add the ability to set python breakpoint commands from the SBBreakpoint SBBreakpointLocation API's.

2014-04-01 Thread Jim Ingham
Author: jingham
Date: Tue Apr  1 20:04:55 2014
New Revision: 205380

URL: http://llvm.org/viewvc/llvm-project?rev=205380view=rev
Log:
Add the ability to set python breakpoint commands from the SBBreakpoint  
SBBreakpointLocation API's.  
You can either provide the function name, or function body text.
Also propagate the compilation error up from where it is checked so we can 
report compilation errors.

rdar://problem/9898371

Modified:
lldb/trunk/include/lldb/API/SBBreakpoint.h
lldb/trunk/include/lldb/API/SBBreakpointLocation.h
lldb/trunk/include/lldb/API/SBError.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/scripts/Python/interface/SBBreakpoint.i
lldb/trunk/scripts/Python/interface/SBBreakpointLocation.i
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=205380r1=205379r2=205380view=diff
==
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Tue Apr  1 20:04:55 2014
@@ -117,7 +117,13 @@ public:
 
 void
 SetCallback (BreakpointHitCallback callback, void *baton);
-
+
+void
+SetScriptCallbackFunction (const char *callback_function_name);
+
+SBError
+SetScriptCallbackBody (const char *script_body_text);
+
 size_t
 GetNumResolvedLocations() const;
 

Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=205380r1=205379r2=205380view=diff
==
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Tue Apr  1 20:04:55 2014
@@ -59,6 +59,12 @@ public:
 GetCondition ();
 
 void
+SetScriptCallbackFunction (const char *callback_function_name);
+
+SBError
+SetScriptCallbackBody (const char *script_body_text);
+
+void
 SetThreadID (lldb::tid_t sb_thread_id);
 
 lldb::tid_t

Modified: lldb/trunk/include/lldb/API/SBError.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=205380r1=205379r2=205380view=diff
==
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Tue Apr  1 20:04:55 2014
@@ -77,6 +77,8 @@ protected:
 friend class SBTarget;
 friend class SBValue;
 friend class SBWatchpoint;
+friend class SBBreakpoint;
+friend class SBBreakpointLocation;
 
 lldb_private::Error *
 get();

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=205380r1=205379r2=205380view=diff
==
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Apr  1 20:04:55 
2014
@@ -254,16 +254,20 @@ public:
 return error;
 }
 
-virtual bool
+virtual Error
 ExportFunctionDefinitionToInterpreter (StringList function_def)
 {
-return false;
+Error error;
+error.SetErrorString(not implemented);
+return error;
 }
 
-virtual bool
+virtual Error
 GenerateBreakpointCommandCallbackData (StringList input, std::string 
output)
 {
-return false;
+Error error;
+error.SetErrorString(not implemented);
+return error;
 }
 
 virtual bool
@@ -359,10 +363,12 @@ public:
 return lldb::ScriptInterpreterObjectSP();
 }
 
-virtual bool
+virtual Error
 GenerateFunction(const char *signature, const StringList input)
 {
-return false;
+Error error;
+error.SetErrorString(unimplemented);
+return error;
 }
 
 virtual void 
@@ -373,10 +379,20 @@ public:
 CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
  CommandReturnObject result);
 
+/// Set the specified text as the callback for the breakpoint.
+virtual Error
+SetBreakpointCommandCallback (BreakpointOptions *bp_options,
+  const char *callback_text)
+{
+Error error;
+error.SetErrorString(unimplemented);
+return error;
+}
+
 /// Set a one-liner as the callback for the breakpoint.
 

[Lldb-commits] [lldb] r205480 - Workaround for collision between enum members in LLVM's MachO.h and system headers

2014-04-02 Thread Jim Ingham
Author: jingham
Date: Wed Apr  2 17:53:21 2014
New Revision: 205480

URL: http://llvm.org/viewvc/llvm-project?rev=205480view=rev
Log:
Workaround for collision between enum members in LLVM's MachO.h and system 
headers
on Mac OS X (in particular mach/machine.h).

rdar://problem/16494607

Added:
lldb/trunk/include/lldb/Utility/SafeMachO.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Host/macosx/Symbols.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp

lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp

Added: lldb/trunk/include/lldb/Utility/SafeMachO.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SafeMachO.h?rev=205480view=auto
==
--- lldb/trunk/include/lldb/Utility/SafeMachO.h (added)
+++ lldb/trunk/include/lldb/Utility/SafeMachO.h Wed Apr  2 17:53:21 2014
@@ -0,0 +1,113 @@
+//===-- SafeMachO.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+#ifndef liblldb_SafeMachO_h_
+#define liblldb_SafeMachO_h_
+
+// This header file is required to work around collisions between the defines 
in mach/machine.h, and enum members
+// of the same name in llvm's MachO.h.  If you want to use 
llvm/Support/MachO.h, use this file instead.
+// The caveats are:
+// 1) You can only use the MachO.h enums, you can't use the defines.  That 
won't make a difference since the values
+//are the same.
+// 2) If you need any header file that relies on mach/machine.h, you must 
include that first.
+// 3) This isn't a total solution, it doesn't undef every define that MachO.h 
has borrowed from various system headers,
+//only the ones that come from mach/machine.h because that is the one we 
ended up pulling in from various places.
+//
+
+#undef CPU_ARCH_MASK
+#undef CPU_ARCH_ABI64 
+
+#undef CPU_TYPE_ANY   
+#undef CPU_TYPE_X86   
+#undef CPU_TYPE_I386  
+#undef CPU_TYPE_X86_64
+#undef CPU_TYPE_MC98000   
+#undef CPU_TYPE_ARM   
+#undef CPU_TYPE_ARM64 
+#undef CPU_TYPE_SPARC 
+#undef CPU_TYPE_POWERPC   
+#undef CPU_TYPE_POWERPC64 
+
+#undef CPU_SUB_TYPE_MASK  
+#undef CPU_SUB_TYPE_LIB64 
+
+#undef CPU_SUBTYPE_MULTIPLE 
+
+#undef CPU_SUBTYPE_I386_ALL   
+#undef CPU_SUBTYPE_386
+#undef CPU_SUBTYPE_486
+#undef CPU_SUBTYPE_486SX  
+#undef CPU_SUBTYPE_586
+#undef CPU_SUBTYPE_PENT   
+#undef CPU_SUBTYPE_PENTPRO
+#undef CPU_SUBTYPE_PENTII_M3  
+#undef CPU_SUBTYPE_PENTII_M5  
+#undef CPU_SUBTYPE_CELERON
+#undef CPU_SUBTYPE_CELERON_MOBILE 
+#undef CPU_SUBTYPE_PENTIUM_3  
+#undef CPU_SUBTYPE_PENTIUM_3_M
+#undef CPU_SUBTYPE_PENTIUM_3_XEON 
+#undef CPU_SUBTYPE_PENTIUM_M  
+#undef CPU_SUBTYPE_PENTIUM_4  
+#undef CPU_SUBTYPE_PENTIUM_4_M
+#undef CPU_SUBTYPE_ITANIUM
+#undef CPU_SUBTYPE_ITANIUM_2  
+#undef CPU_SUBTYPE_XEON   
+#undef CPU_SUBTYPE_XEON_MP
+
+#undef CPU_SUBTYPE_X86_ALL 
+#undef CPU_SUBTYPE_X86_64_ALL  
+#undef CPU_SUBTYPE_X86_ARCH1   
+#undef CPU_SUBTYPE_X86_64_H
+
+#undef CPU_SUBTYPE_INTEL
+#undef CPU_SUBTYPE_INTEL_FAMILY
+#undef CPU_SUBTYPE_INTEL_FAMILY_MAX
+#undef CPU_SUBTYPE_INTEL_MODEL 
+#undef CPU_SUBTYPE_INTEL_MODEL_ALL  
+
+#undef CPU_SUBTYPE_ARM
+#undef CPU_SUBTYPE_ARM_ALL 
+#undef CPU_SUBTYPE_ARM_V4T 
+#undef CPU_SUBTYPE_ARM_V6  
+#undef CPU_SUBTYPE_ARM_V5  
+#undef CPU_SUBTYPE_ARM_V5TEJ   
+#undef CPU_SUBTYPE_ARM_XSCALE  

[Lldb-commits] [lldb] r205494 - I removed SetCallback from the Python API's since it wasn't actually useful, and added SetScriptCallbackFunction,

2014-04-02 Thread Jim Ingham
Author: jingham
Date: Wed Apr  2 19:50:56 2014
New Revision: 205494

URL: http://llvm.org/viewvc/llvm-project?rev=205494view=rev
Log:
I removed SetCallback from the Python API's since it wasn't actually useful, 
and added SetScriptCallbackFunction,
and SetScriptCallbackBody.  So add these to the default constructor test case.

Modified:
lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py

Modified: lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py?rev=205494r1=205493r2=205494view=diff
==
--- lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py Wed Apr  2 
19:50:56 2014
@@ -27,7 +27,8 @@ def fuzz_obj(obj):
 obj.GetThreadName()
 obj.SetQueueName(my queue)
 obj.GetQueueName()
-obj.SetCallback(None, None)
+obj.SetScriptCallbackFunction(None)
+obj.SetScriptCallbackBody (None)
 obj.GetNumResolvedLocations()
 obj.GetNumLocations()
 obj.GetDescription(lldb.SBStream())


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205496 - Print the new eStopReasonExec in stop_reason_to_str.

2014-04-02 Thread Jim Ingham
Author: jingham
Date: Wed Apr  2 20:25:28 2014
New Revision: 205496

URL: http://llvm.org/viewvc/llvm-project?rev=205496view=rev
Log:
Print the new eStopReasonExec in stop_reason_to_str.

Modified:
lldb/trunk/test/lldbutil.py

Modified: lldb/trunk/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=205496r1=205495r2=205496view=diff
==
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Wed Apr  2 20:25:28 2014
@@ -175,6 +175,8 @@ def stop_reason_to_str(enum):
 return breakpoint
 elif enum == lldb.eStopReasonWatchpoint:
 return watchpoint
+elif enum == lldb.eStopReasonExec:
+return exec
 elif enum == lldb.eStopReasonSignal:
 return signal
 elif enum == lldb.eStopReasonException:


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205497 - Make the fail messages

2014-04-02 Thread Jim Ingham
Author: jingham
Date: Wed Apr  2 20:26:14 2014
New Revision: 205497

URL: http://llvm.org/viewvc/llvm-project?rev=205497view=rev
Log:
Make the fail messages

Modified:
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/test/lang/c/stepping/TestStepAndBreakpoints.py
lldb/trunk/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=205497r1=205496r2=205497view=diff
==
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Wed Apr  2 20:26:14 2014
@@ -209,10 +209,22 @@ public:
 {
 return m_resume_state;
 }
-
+
+// This sets the external resume state of the thread.  If the thread is 
suspended here, it should never
+// get scheduled.  Note that just because a thread is marked as running 
does not mean we will let it run in
+// a given bit of process control.  For instance step tries to stay on 
the selected thread it was issued on,
+// which may involve suspending other threads temporarily.  This temporary 
suspension is NOT reflected in the
+// state set here and reported in GetResumeState.
+//
+// If you are just preparing all threads to run, you should not override 
the threads that are
+// marked as suspended by the debugger.  In that case, pass 
override_suspend = false.  If you want
+// to force the thread to run (e.g. the thread continue command, or are 
resetting the state
+// (e.g. in SBThread::Resume()), then pass true to override_suspend.
 void
-SetResumeState (lldb::StateType state)
+SetResumeState (lldb::StateType state, bool override_suspend = false)
 {
+if (m_resume_state == lldb::eStateSuspended  !override_suspend)
+return;
 m_resume_state = state;
 }
 

Modified: lldb/trunk/source/API/SBThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=205497r1=205496r2=205497view=diff
==
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Wed Apr  2 20:26:14 2014
@@ -1028,7 +1028,8 @@ SBThread::Resume ()
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(exe_ctx.GetProcessPtr()-GetRunLock()))
 {
-exe_ctx.GetThreadPtr()-SetResumeState (eStateRunning);
+const bool override_suspend = true;
+exe_ctx.GetThreadPtr()-SetResumeState (eStateRunning, 
override_suspend);
 result = true;
 }
 else

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=205497r1=205496r2=205497view=diff
==
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Wed Apr  2 20:26:14 2014
@@ -758,7 +758,8 @@ protected:
 // Set the actions that the threads should each take when 
resuming
 for (uint32_t idx=0; idxnum_threads; ++idx)
 {
-
process-GetThreadList().GetThreadAtIndex(idx)-SetResumeState (eStateRunning);
+const bool override_suspend = false;
+
process-GetThreadList().GetThreadAtIndex(idx)-SetResumeState (eStateRunning, 
override_suspend);
 }
 }
 

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=205497r1=205496r2=205497view=diff
==
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Wed Apr  2 20:26:14 2014
@@ -794,8 +794,9 @@ public:
 result.AppendMessageWithFormat (%u, , 
thread-GetIndexID());
 else
 result.AppendMessageWithFormat (%u , 
thread-GetIndexID());
-
-thread-SetResumeState (eStateRunning);
+
+const bool override_suspend = true;
+thread-SetResumeState (eStateRunning, 
override_suspend);
 }
 else
 {
@@ -826,7 +827,8 @@ public:
 if (thread == current_thread)
 {
  

[Lldb-commits] [lldb] r205544 - Get dis -c -s working again.

2014-04-03 Thread Jim Ingham
Author: jingham
Date: Thu Apr  3 12:16:17 2014
New Revision: 205544

URL: http://llvm.org/viewvc/llvm-project?rev=205544view=rev
Log:
Get dis -c -s working again.

pr19324

Modified:
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=205544r1=205543r2=205544view=diff
==
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Thu Apr  3 12:16:17 
2014
@@ -442,8 +442,8 @@ CommandObjectDisassemble::DoExecute (Arg
 return false;
 }
 range.SetByteSize (m_options.end_addr - 
m_options.start_addr);
-ranges.push_back(range);
 }
+ranges.push_back(range);
 }
 else
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205636 - Remember to clear the cached data for the OptionValueFileSpec in SetValueFromCString.

2014-04-04 Thread Jim Ingham
Author: jingham
Date: Fri Apr  4 13:06:54 2014
New Revision: 205636

URL: http://llvm.org/viewvc/llvm-project?rev=205636view=rev
Log:
Remember to clear the cached data for the OptionValueFileSpec in 
SetValueFromCString.

rdar://problem/16179718 target.expr-prefix contents appear to be cached for 
an entire session

Modified:
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=205636r1=205635r2=205636view=diff
==
--- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Fri Apr  4 13:06:54 
2014
@@ -99,6 +99,7 @@ OptionValueFileSpec::SetValueFromCString
 
 m_value_was_set = true;
 m_current_value.SetFile(filepath.c_str(), true);
+m_data_sp.reset();
 }
 else
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205790 - This function should be const.

2014-04-08 Thread Jim Ingham
Author: jingham
Date: Tue Apr  8 15:24:45 2014
New Revision: 205790

URL: http://llvm.org/viewvc/llvm-project?rev=205790view=rev
Log:
This function should be const.

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=205790r1=205789r2=205790view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue Apr  8 15:24:45 
2014
@@ -145,7 +145,8 @@ public:
 /// @return
 /// The synchronicity of our callback.
 //--
-bool IsCallbackSynchronous () {
+bool IsCallbackSynchronous () const
+{
 return m_callback_is_synchronous;
 }
 
@@ -280,7 +281,7 @@ public:
 /// Returns true if the breakpoint option has a callback set.
 //--
 bool
-HasCallback();
+HasCallback() const;
 
 //--
 /// This is the default empty callback.

Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=205790r1=205789r2=205790view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Tue Apr  8 15:24:45 2014
@@ -154,7 +154,7 @@ BreakpointOptions::InvokeCallback (Stopp
 }
 
 bool
-BreakpointOptions::HasCallback ()
+BreakpointOptions::HasCallback () const
 {
 return m_callback != BreakpointOptions::NullCallback;
 }


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r205803 - Fix the behavior when hand-calling a function times out on one thread,

2014-04-08 Thread Jim Ingham
Author: jingham
Date: Tue Apr  8 16:33:21 2014
New Revision: 205803

URL: http://llvm.org/viewvc/llvm-project?rev=205803view=rev
Log:
Fix the behavior when hand-calling a function times out on one thread,
but by the time we go to halt, it has already stopped by hitting the 
function end breakpoint.  That wasn't being shown to the threads so the
Function call thread plan didn't know its job was done.

rdar://problem/16515785

Modified:
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/ThreadList.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=205803r1=205802r2=205803view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Apr  8 16:33:21 2014
@@ -3901,6 +3901,9 @@ Process::ShouldBroadcastEvent (Event *ev
 log-Printf (Process::ShouldBroadcastEvent (%p) stopped 
due to an interrupt, state: %s,
  static_castvoid*(event_ptr),
  StateAsCString(state));
+// Even though we know we are going to stop, we should let the 
threads have a look at the stop,
+// so they can properly set their state.
+m_thread_list.ShouldStop (event_ptr);
 return_value = true;
 }
 else
@@ -4381,8 +4384,14 @@ Process::ProcessEventData::DoOnRemoval (
 return;
 
 m_process_sp-SetPublicState (m_state, 
Process::ProcessEventData::GetRestartedFromEvent(event_ptr));
-
-// If we're stopped and haven't restarted, then do the breakpoint commands 
here:
+
+// If this is a halt event, even if the halt stopped with some reason 
other than a plain interrupt (e.g. we had
+// already stopped for a breakpoint when the halt request came through) 
don't do the StopInfo actions, as they may
+// end up restarting the process.
+if (m_interrupted)
+return;
+
+// If we're stopped and haven't restarted, then do the StopInfo actions 
here:
 if (m_state == eStateStopped  ! m_restarted)
 {
 ThreadList curr_thread_list = m_process_sp-GetThreadList();
@@ -5253,7 +5262,17 @@ Process::RunThreadPlan (ExecutionContext
 
 // This while loop must exit out the bottom, there's cleanup that we 
need to do when we are done.
 // So don't call return anywhere within it.
-
+
+#ifdef LLDB_RUN_THREAD_HALT_WITH_EVENT
+// It's pretty much impossible to write test cases for things like:
+// One thread timeout expires, I go to halt, but the process already 
stopped
+// on the function call stop breakpoint.  Turning on this define will 
make us not
+// fetch the first event till after the halt.  So if you run a quick 
function, it will have
+// completed, and the completion event will be waiting, when you 
interrupt for halt.
+// The expression evaluation should still succeed.
+bool miss_first_event = true;
+#endif
+
 while (1)
 {
 // We usually want to resume the process if we get to the top of 
the loop.
@@ -5383,7 +5402,17 @@ Process::RunThreadPlan (ExecutionContext
 log-Printf (Process::RunThreadPlan(): about to wait 
forever.);
 }
 }
-
+
+#ifdef LLDB_RUN_THREAD_HALT_WITH_EVENT
+// See comment above...
+if (miss_first_event)
+{
+usleep(1000);
+miss_first_event = false;
+got_event = false;
+}
+else
+#endif
 got_event = listener.WaitForEvent (timeout_ptr, event_sp);
 
 if (got_event)

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=205803r1=205802r2=205803view=diff
==
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Tue Apr  8 16:33:21 2014
@@ -262,7 +262,7 @@ ThreadList::ShouldStop (Event *event_ptr
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
 // The ShouldStop method of the threads can do a whole lot of work,
-// running breakpoint commands  conditions, etc.  So we don't want
+// figuring out whether the thread plan conditions are met.  So we don't 
want
 // to keep the ThreadList locked the whole time we are doing this.
 // FIXME: It is possible that running code could cause new threads
 // to be created.  If that happens we will miss asking them whether
@@ -287,7 +287,16 @@ ThreadList::ShouldStop (Event *event_ptr
 }
 
 bool did_anybody_stop_for_a_reason = false;
+  

[Lldb-commits] [lldb] r206350 - m_interrupt_sent wasn't being initialized, and wasn't being reset after an

2014-04-15 Thread Jim Ingham
Author: jingham
Date: Tue Apr 15 21:24:17 2014
New Revision: 206350

URL: http://llvm.org/viewvc/llvm-project?rev=206350view=rev
Log:
m_interrupt_sent wasn't being initialized, and wasn't being reset after an
interrupt.  Do both of those.

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=206350r1=206349r2=206350view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Apr 15 21:24:17 2014
@@ -94,6 +94,7 @@ GDBRemoteCommunicationClient::GDBRemoteC
 m_async_result (PacketResult::Success),
 m_async_response (),
 m_async_signal (-1),
+m_interrupt_sent (false),
 m_thread_id_to_used_usec_map (),
 m_host_arch(),
 m_process_arch(),
@@ -799,6 +800,8 @@ GDBRemoteCommunicationClient::SendContin
 log-Printf (GDBRemoteCommunicationClient::%s () sending 
continue packet: %s, __FUNCTION__, continue_packet.c_str());
 if (SendPacketNoLock(continue_packet.c_str(), 
continue_packet.size()) != PacketResult::Success)
 state = eStateInvalid;
+else
+m_interrupt_sent = false;
 
 m_private_is_running.SetValue (true, eBroadcastAlways);
 }


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r206351 - Clean up the logic in setting timeouts a bit, and the logging as well.

2014-04-15 Thread Jim Ingham
Author: jingham
Date: Tue Apr 15 21:24:48 2014
New Revision: 206351

URL: http://llvm.org/viewvc/llvm-project?rev=206351view=rev
Log:
Clean up the logic in setting timeouts a bit, and the logging as well.

Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=206351r1=206350r2=206351view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Apr 15 21:24:48 2014
@@ -5196,13 +5196,17 @@ Process::RunThreadPlan (ExecutionContext
 TimeValue final_timeout = one_thread_timeout;
 
 uint32_t timeout_usec = options.GetTimeoutUsec();
-
-if (!options.GetStopOthers())
+
+// If we are going to run all threads the whole time, or if we are 
only going to run one thread,
+// then we don't need the first timeout.  So we set the final timeout, 
and pretend we are after the
+// first timeout already.
+
+if (!options.GetStopOthers() || !options.GetTryAllThreads())
 {
 before_first_timeout = false;
 final_timeout.OffsetWithMicroSeconds(timeout_usec);
 }
-else if (options.GetTryAllThreads())
+else
 {
 uint64_t option_one_thread_timeout = 
options.GetOneThreadTimeoutUsec();
 
@@ -5238,11 +5242,15 @@ Process::RunThreadPlan (ExecutionContext
 }
 final_timeout.OffsetWithMicroSeconds (timeout_usec);
 }
-else
-{
-if (timeout_usec != 0)
-final_timeout.OffsetWithMicroSeconds(timeout_usec);
-}
+
+if (log)
+log-Printf (Stop others: %u, try all: %u, one thread: % PRIu64 
 - all threads: % PRIu64 .\n,
+ options.GetStopOthers(),
+ options.GetTryAllThreads(),
+ one_thread_timeout.GetAsMicroSecondsSinceJan1_1970(),
+ final_timeout.GetAsMicroSecondsSinceJan1_1970());
+
+
 
 // This isn't going to work if there are unfetched events on the queue.
 // Are there cases where we might want to run the remaining events 
here, and then try to
@@ -5551,11 +5559,21 @@ Process::RunThreadPlan (ExecutionContext
 if (log) {
 if (options.GetTryAllThreads())
 {
-uint64_t remaining_time = final_timeout - 
TimeValue::Now();
 if (before_first_timeout)
-log-Printf (Process::RunThreadPlan(): Running 
function with one thread timeout timed out, 
- running till  for % PRIu64  usec 
with all threads enabled.,
- remaining_time);
+{
+if (timeout_usec != 0)
+{
+uint64_t remaining_time = final_timeout - 
TimeValue::Now();
+log-Printf (Process::RunThreadPlan(): 
Running function with one thread timeout timed out, 
+ running for % PRIu64  usec 
with all threads enabled.,
+ remaining_time);
+}
+else
+{
+log-Printf (Process::RunThreadPlan(): 
Running function with one thread timeout timed out, 
+ running for ever with all 
threads enabled.);
+}
+}
 else
 log-Printf (Process::RunThreadPlan(): Restarting 
function with all threads enabled 
  and timeout: %u timed out, 
abandoning execution.,


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r206835 - Make RunThreadPlan start the timeout clock for each part of the expression evaluation AFTER the

2014-04-21 Thread Jim Ingham
Author: jingham
Date: Mon Apr 21 20:41:52 2014
New Revision: 206835

URL: http://llvm.org/viewvc/llvm-project?rev=206835view=rev
Log:
Make RunThreadPlan start the timeout clock for each part of the expression 
evaluation AFTER the
successful resume for that part.  This will make the timeouts more stable when 
lldb is running
in a busy program.

Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=206835r1=206834r2=206835view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Apr 21 20:41:52 2014
@@ -5198,10 +5198,9 @@ Process::RunThreadPlan (ExecutionContext
 // This is just for accounting:
 uint32_t num_resumes = 0;
 
-TimeValue one_thread_timeout = TimeValue::Now();
-TimeValue final_timeout = one_thread_timeout;
-
 uint32_t timeout_usec = options.GetTimeoutUsec();
+uint32_t one_thread_timeout_usec;
+uint32_t all_threads_timeout_usec = 0;
 
 // If we are going to run all threads the whole time, or if we are 
only going to run one thread,
 // then we don't need the first timeout.  So we set the final timeout, 
and pretend we are after the
@@ -5210,19 +5209,20 @@ Process::RunThreadPlan (ExecutionContext
 if (!options.GetStopOthers() || !options.GetTryAllThreads())
 {
 before_first_timeout = false;
-final_timeout.OffsetWithMicroSeconds(timeout_usec);
+one_thread_timeout_usec = 0;
+all_threads_timeout_usec = timeout_usec;
 }
 else
 {
-uint64_t option_one_thread_timeout = 
options.GetOneThreadTimeoutUsec();
+uint32_t option_one_thread_timeout = 
options.GetOneThreadTimeoutUsec();
 
 // If the overall wait is forever, then we only need to set the 
one thread timeout:
 if (timeout_usec == 0)
 {
 if (option_one_thread_timeout != 0)
-
one_thread_timeout.OffsetWithMicroSeconds(option_one_thread_timeout);
+one_thread_timeout_usec = option_one_thread_timeout;
 else
-
one_thread_timeout.OffsetWithMicroSeconds(default_one_thread_timeout_usec);
+one_thread_timeout_usec = default_one_thread_timeout_usec;
 }
 else
 {
@@ -5244,19 +5244,19 @@ Process::RunThreadPlan (ExecutionContext
 if (computed_one_thread_timeout  
default_one_thread_timeout_usec)
 computed_one_thread_timeout = 
default_one_thread_timeout_usec;
 }
-
one_thread_timeout.OffsetWithMicroSeconds(computed_one_thread_timeout);
+one_thread_timeout_usec = computed_one_thread_timeout;
+all_threads_timeout_usec = timeout_usec - 
one_thread_timeout_usec;
+
 }
-final_timeout.OffsetWithMicroSeconds (timeout_usec);
 }
 
 if (log)
-log-Printf (Stop others: %u, try all: %u, one thread: % PRIu64 
 - all threads: % PRIu64 .\n,
+log-Printf (Stop others: %u, try all: %u, before_first: %u, one 
thread: % PRIu32  - all threads: % PRIu32 .\n,
  options.GetStopOthers(),
  options.GetTryAllThreads(),
- one_thread_timeout.GetAsMicroSecondsSinceJan1_1970(),
- final_timeout.GetAsMicroSecondsSinceJan1_1970());
-
-
+ before_first_timeout,
+ one_thread_timeout_usec,
+ all_threads_timeout_usec);
 
 // This isn't going to work if there are unfetched events on the queue.
 // Are there cases where we might want to run the remaining events 
here, and then try to
@@ -5286,6 +5286,9 @@ Process::RunThreadPlan (ExecutionContext
 // The expression evaluation should still succeed.
 bool miss_first_event = true;
 #endif
+TimeValue one_thread_timeout;
+TimeValue final_timeout;
+
 
 while (1)
 {
@@ -5380,13 +5383,21 @@ Process::RunThreadPlan (ExecutionContext
 if (before_first_timeout)
 {
 if (options.GetTryAllThreads())
+{
+one_thread_timeout = TimeValue::Now();
+
one_thread_timeout.OffsetWithMicroSeconds(one_thread_timeout_usec);
 timeout_ptr = one_thread_timeout;
+}
 else
 {
 if (timeout_usec == 0)
 timeout_ptr = NULL;
 else
+{
+final_timeout = 

[Lldb-commits] [lldb] r206836 - Give the clang functions names. This is only for logging.

2014-04-21 Thread Jim Ingham
Author: jingham
Date: Mon Apr 21 20:42:22 2014
New Revision: 206836

URL: http://llvm.org/viewvc/llvm-project?rev=206836view=rev
Log:
Give the clang functions names.  This is only for logging.

Modified:
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/source/Expression/ClangFunction.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=206836r1=206835r2=206836view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Mon Apr 21 20:42:22 2014
@@ -88,7 +88,8 @@ public:
 ClangFunction (ExecutionContextScope exe_scope,
Function function_ptr, 
ClangASTContext *ast_context, 
-   const ValueList arg_value_list);
+   const ValueList arg_value_list,
+   const char *name);
 
 //--
 /// Constructor
@@ -114,7 +115,8 @@ public:
 ClangFunction (ExecutionContextScope exe_scope,
const ClangASTType return_type,
const Address function_address, 
-   const ValueList arg_value_list);
+   const ValueList arg_value_list,
+   const char *name);
 
 //--
 /// Destructor
@@ -412,6 +414,7 @@ private:
 std::unique_ptrClangExpressionParser m_parser; /// The 
parser responsible for compiling the function.
 std::shared_ptrIRExecutionUnit m_execution_unit_sp;
 lldb::ModuleWP  m_jit_module_wp;
+std::string m_name; /// The 
name of this clang function - for debugging purposes.
 
 Function   *m_function_ptr; /// The 
function we're going to call.  May be NULL if we don't have debug info for the 
function.
 Address m_function_addr;/// If we 
don't have the FunctionSP, we at least need the address  return type.

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=206836r1=206835r2=206836view=diff
==
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Mon Apr 21 20:42:22 2014
@@ -54,11 +54,13 @@ ClangFunction::ClangFunction
 ExecutionContextScope exe_scope,
 const ClangASTType return_type, 
 const Address functionAddress, 
-const ValueList arg_value_list
+const ValueList arg_value_list,
+const char *name
 ) :
 m_parser(),
 m_execution_unit_sp(),
 m_jit_module_wp(),
+m_name (name ? name : unknown),
 m_function_ptr (NULL),
 m_function_addr (functionAddress),
 m_function_return_type(return_type),
@@ -79,8 +81,10 @@ ClangFunction::ClangFunction
 ExecutionContextScope exe_scope,
 Function function, 
 ClangASTContext *ast_context, 
-const ValueList arg_value_list
+const ValueList arg_value_list,
+const char *name
 ) :
+m_name (name ? name : unknown),
 m_function_ptr (function),
 m_function_addr (),
 m_function_return_type (),
@@ -427,7 +431,7 @@ ClangFunction::GetThreadPlanToCallFuncti
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | 
LIBLLDB_LOG_STEP));
 
 if (log)
-log-Printf(-- [ClangFunction::GetThreadPlanToCallFunction] Creating 
thread plan to call function --);
+log-Printf(-- [ClangFunction::GetThreadPlanToCallFunction] Creating 
thread plan to call function \%s\ --, m_name.c_str());
 
 // FIXME: Use the errors Stream for better error reporting.
 Thread *thread = exe_ctx.GetThreadPtr();
@@ -464,7 +468,7 @@ ClangFunction::FetchFunctionResults (Exe
 Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EXPRESSIONS | 
LIBLLDB_LOG_STEP));
 
 if (log)
-log-Printf(-- [ClangFunction::FetchFunctionResults] Fetching 
function results --);
+

[Lldb-commits] [lldb] r207944 - Make the Expression Execution result enum available to the SB API layer.

2014-05-04 Thread Jim Ingham
Author: jingham
Date: Sun May  4 21:26:40 2014
New Revision: 207944

URL: http://llvm.org/viewvc/llvm-project?rev=207944view=rev
Log:
Make the Expression Execution result enum available to the SB API layer.
Add a callback that will allow an expression to be cancelled between the
expression evaluation stages (for the ClangUserExpressions.)

rdar://problem/16790467, rdar://problem/16573440

Modified:
lldb/trunk/include/lldb/API/SBExpressionOptions.h
lldb/trunk/include/lldb/Core/Error.h
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
lldb/trunk/include/lldb/lldb-types.h
lldb/trunk/source/API/SBExpressionOptions.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Core/Error.cpp
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=207944r1=207943r2=207944view=diff
==
--- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Sun May  4 21:26:40 2014
@@ -86,6 +86,9 @@ public:
 
 void
 SetTrapExceptions (bool trap_exceptions = true);
+
+void
+SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton);
 
 protected:
 

Modified: lldb/trunk/include/lldb/Core/Error.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Error.h?rev=207944r1=207943r2=207944view=diff
==
--- lldb/trunk/include/lldb/Core/Error.h (original)
+++ lldb/trunk/include/lldb/Core/Error.h Sun May  4 21:26:40 2014
@@ -209,6 +209,13 @@ public:
 void
 SetMachError (uint32_t err);
 
+
+void
+SetExpressionError (lldb::ExpressionResults, const char *mssg);
+
+int
+SetExpressionErrorWithFormat (lldb::ExpressionResults, const char *format, 
...) __attribute__ ((format (printf, 3,4)));
+
 //--
 /// Set accesssor with an error value and type.
 ///

Modified: lldb/trunk/include/lldb/Expression/ClangFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangFunction.h?rev=207944r1=207943r2=207944view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangFunction.h Sun May  4 21:26:40 2014
@@ -253,9 +253,9 @@ public:
 /// The result value will be put here after running the function.
 ///
 /// @return
-/// Returns one of the ExecutionResults enum indicating function call 
status.
+/// Returns one of the ExpressionResults enum indicating function call 
status.
 //--
-ExecutionResults 
+lldb::ExpressionResults
 ExecuteFunction(ExecutionContext exe_ctx, 
 lldb::addr_t *args_addr_ptr, 
 const EvaluateExpressionOptions options,

Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=207944r1=207943r2=207944view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Sun May  4 
21:26:40 2014
@@ -144,7 +144,7 @@ public:
 

[Lldb-commits] [lldb] r207945 - Rename eExecution*** to eExpression*** to be consistent with the result type.

2014-05-04 Thread Jim Ingham
Author: jingham
Date: Sun May  4 21:47:44 2014
New Revision: 207945

URL: http://llvm.org/viewvc/llvm-project?rev=207945view=rev
Log:
Rename eExecution*** to eExpression*** to be consistent with the result type.

Modified:
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/DataFormatters/CF.cpp
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp

lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=207945r1=207944r2=207945view=diff
==
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Sun May  4 
21:47:44 2014
@@ -296,7 +296,7 @@ public:
 /// fails to parse, run, or evaluated.
 ///
 /// @result
-///  A Process::ExpressionResults value.  eExecutionCompleted for 
success.
+///  A Process::ExpressionResults value.  eExpressionCompleted for 
success.
 //--
 static lldb::ExpressionResults
 Evaluate (ExecutionContext exe_ctx,

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=207945r1=207944r2=207945view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Sun May  4 21:47:44 2014
@@ -204,15 +204,15 @@ namespace lldb {
 //--
 typedef enum ExpressionResults
 {
-eExecutionCompleted = 0,
-eExecutionSetupError,
-eExecutionParseError,
-eExecutionDiscarded,
-eExecutionInterrupted,
-eExecutionHitBreakpoint,
-eExecutionTimedOut,
-eExecutionResultUnavailable,
-eExecutionStoppedForDebug
+eExpressionCompleted = 0,
+eExpressionSetupError,
+eExpressionParseError,
+eExpressionDiscarded,
+eExpressionInterrupted,
+eExpressionHitBreakpoint,
+eExpressionTimedOut,
+eExpressionResultUnavailable,
+eExpressionStoppedForDebug
 } ExpressionResults;
 
 //--

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=207945r1=207944r2=207945view=diff
==
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Sun May  4 21:47:44 2014
@@ -1372,7 +1372,7 @@ SBFrame::EvaluateExpression (const char
 
 Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
-ExpressionResults exe_results = eExecutionSetupError;
+ExpressionResults exe_results = eExpressionSetupError;
 SBValue expr_result;
 
 if (expr == NULL || expr[0] == '\0')

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=207945r1=207944r2=207945view=diff
==
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Sun May  4 21:47:44 2014
@@ -2611,7 +2611,7 @@ SBTarget::EvaluateExpression (const char
 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 SBValue expr_result;
-ExpressionResults exe_results = eExecutionSetupError;
+ExpressionResults exe_results = 

[Lldb-commits] [lldb] r209010 - Fix from: Scott Knight(knigh...@gmail.com):

2014-05-16 Thread Jim Ingham
Author: jingham
Date: Fri May 16 14:46:56 2014
New Revision: 209010

URL: http://llvm.org/viewvc/llvm-project?rev=209010view=rev
Log:
Fix from: Scott Knight(knigh...@gmail.com):

Use a map rather than a vector to store the objects managed by the shared 
cluster since mostly want this for random lookup, so the map is much faster.

Modified:
lldb/trunk/include/lldb/Utility/SharedCluster.h

Modified: lldb/trunk/include/lldb/Utility/SharedCluster.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharedCluster.h?rev=209010r1=209009r2=209010view=diff
==
--- lldb/trunk/include/lldb/Utility/SharedCluster.h (original)
+++ lldb/trunk/include/lldb/Utility/SharedCluster.h Fri May 16 14:46:56 2014
@@ -13,6 +13,8 @@
 #include lldb/Utility/SharingPtr.h
 #include lldb/Host/Mutex.h
 
+#include llvm/ADT/SmallPtrSet.h
+
 namespace lldb_private {
 
 namespace imp
@@ -50,11 +52,12 @@ public:
 
 ~ClusterManager ()
 {
-size_t n_items = m_objects.size();
-for (size_t i = 0; i  n_items; i++)
+for (typename llvm::SmallPtrSetT *, 16::iterator pos = 
m_objects.begin(), end = m_objects.end(); pos != end; ++pos)
 {
-delete m_objects[i];
+T *object = *pos;
+delete object;
 }
+
 // Decrement refcount should have been called on this ClusterManager,
 // and it should have locked the mutex, now we will unlock it before
 // we destroy it...
@@ -64,8 +67,7 @@ public:
 void ManageObject (T *new_object)
 {
 Mutex::Locker locker (m_mutex);
-if (!ContainsObject(new_object))
-m_objects.push_back (new_object);
+m_objects.insert (new_object);
 }
 
 typename lldb_private::SharingPtrT GetSharedPointer(T *desired_object)
@@ -73,20 +75,13 @@ public:
 {
 Mutex::Locker locker (m_mutex);
 m_external_ref++;
-assert (ContainsObject(desired_object));
+assert (m_objects.count(desired_object));
 }
 return typename lldb_private::SharingPtrT (desired_object, new 
imp::shared_ptr_refcountClusterManager (this));
 }
 
 private:
 
-bool ContainsObject (const T *desired_object)
-{
-typename std::vectorT *::iterator pos, end = m_objects.end();
-pos = std::find(m_objects.begin(), end, desired_object);
-return pos != end;
-}
-
 void DecrementRefCount () 
 {
 m_mutex.Lock();
@@ -99,7 +94,7 @@ private:
 
 friend class imp::shared_ptr_refcountClusterManager;
 
-std::vectorT * m_objects;
+llvm::SmallPtrSetT *, 16 m_objects;
 int m_external_ref;
 Mutex m_mutex;
 };


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r211136 - Add locking around the m_owners collection in the breakpoint site. If we are in the middle of BreakpointLocation::ShouldStop we don't

2014-06-17 Thread Jim Ingham
Author: jingham
Date: Tue Jun 17 20:04:40 2014
New Revision: 211136

URL: http://llvm.org/viewvc/llvm-project?rev=211136view=rev
Log:
Add locking around the m_owners collection in the breakpoint site.  If we are 
in the middle of BreakpointLocation::ShouldStop we don't
want other commands (like break disable) to mutate the owners of this 
breakpoint out from under us.

rdar://problem/17255589

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
lldb/trunk/source/Breakpoint/BreakpointSite.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=211136r1=211135r2=211136view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Tue Jun 17 20:04:40 2014
@@ -19,6 +19,7 @@
 
 // Project includes
 #include lldb/lldb-private.h
+#include lldb/Host/Mutex.h
 #include lldb/Core/UserID.h
 #include lldb/Breakpoint/StoppointLocation.h
 #include lldb/Breakpoint/BreakpointLocationCollection.h
@@ -277,6 +278,7 @@ private:
 // Consider adding an optimization where if there is only one
 // owner, we don't store a list.  The usual case will be only one owner...
 BreakpointLocationCollection m_owners; /// This has the 
BreakpointLocations that share this breakpoint site.
+Mutex m_owners_mutex;  /// This mutex protects the owners collection. 
 
 static lldb::break_id_t
 GetNextID();

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=211136r1=211135r2=211136view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Tue Jun 17 20:04:40 2014
@@ -32,7 +32,8 @@ BreakpointSite::BreakpointSite
 m_saved_opcode(),
 m_trap_opcode(),
 m_enabled(false), // Need to create it disabled, so the first enable turns 
it on.
-m_owners()
+m_owners(),
+m_owners_mutex(Mutex::eMutexTypeRecursive)
 {
 m_owners.Add(owner);
 }
@@ -60,6 +61,7 @@ BreakpointSite::GetNextID()
 bool
 BreakpointSite::ShouldStop (StoppointCallbackContext *context)
 {
+Mutex::Locker(m_owners_mutex);
 IncrementHitCount();
 return m_owners.ShouldStop (context);
 }
@@ -67,6 +69,7 @@ BreakpointSite::ShouldStop (StoppointCal
 bool
 BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
 {
+Mutex::Locker(m_owners_mutex);
 const size_t owner_count = m_owners.GetSize();
 for (size_t i = 0; i  owner_count; i++)
 {
@@ -93,6 +96,7 @@ BreakpointSite::Dump(Stream *s) const
 void
 BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
+Mutex::Locker(m_owners_mutex);
 if (level != lldb::eDescriptionLevelBrief)
 s-Printf (breakpoint site: %d at 0x%8.8 PRIx64, GetID(), 
GetLoadAddress());
 m_owners.GetDescription (s, level);
@@ -101,6 +105,7 @@ BreakpointSite::GetDescription (Stream *
 bool
 BreakpointSite::IsInternal() const
 {
+Mutex::Locker(m_owners_mutex);
 return m_owners.IsInternal();
 }
 
@@ -162,12 +167,14 @@ BreakpointSite::SetEnabled (bool enabled
 void
 BreakpointSite::AddOwner (const BreakpointLocationSP owner)
 {
+Mutex::Locker(m_owners_mutex);
 m_owners.Add(owner);
 }
 
 size_t
 BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t 
break_loc_id)
 {
+Mutex::Locker(m_owners_mutex);
 m_owners.Remove(break_id, break_loc_id);
 return m_owners.GetSize();
 }
@@ -175,18 +182,21 @@ BreakpointSite::RemoveOwner (lldb::break
 size_t
 BreakpointSite::GetNumberOfOwners ()
 {
+Mutex::Locker(m_owners_mutex);
 return m_owners.GetSize();
 }
 
 BreakpointLocationSP
 BreakpointSite::GetOwnerAtIndex (size_t index)
 {
+Mutex::Locker(m_owners_mutex);
 return m_owners.GetByIndex (index);
 }
 
 bool
 BreakpointSite::ValidForThisThread (Thread *thread)
 {
+Mutex::Locker(m_owners_mutex);
 return m_owners.ValidForThisThread(thread);
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r211242 - Actually make a real scoped locker rather than constructing one that gets immediately thrown away...

2014-06-18 Thread Jim Ingham
Author: jingham
Date: Wed Jun 18 18:40:13 2014
New Revision: 211242

URL: http://llvm.org/viewvc/llvm-project?rev=211242view=rev
Log:
Actually make a real scoped locker rather than constructing one that gets 
immediately thrown away... 

Modified:
lldb/trunk/source/Breakpoint/BreakpointSite.cpp

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=211242r1=211241r2=211242view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Wed Jun 18 18:40:13 2014
@@ -61,7 +61,7 @@ BreakpointSite::GetNextID()
 bool
 BreakpointSite::ShouldStop (StoppointCallbackContext *context)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 IncrementHitCount();
 return m_owners.ShouldStop (context);
 }
@@ -69,7 +69,7 @@ BreakpointSite::ShouldStop (StoppointCal
 bool
 BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 const size_t owner_count = m_owners.GetSize();
 for (size_t i = 0; i  owner_count; i++)
 {
@@ -96,7 +96,7 @@ BreakpointSite::Dump(Stream *s) const
 void
 BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 if (level != lldb::eDescriptionLevelBrief)
 s-Printf (breakpoint site: %d at 0x%8.8 PRIx64, GetID(), 
GetLoadAddress());
 m_owners.GetDescription (s, level);
@@ -105,7 +105,6 @@ BreakpointSite::GetDescription (Stream *
 bool
 BreakpointSite::IsInternal() const
 {
-Mutex::Locker(m_owners_mutex);
 return m_owners.IsInternal();
 }
 
@@ -167,14 +166,14 @@ BreakpointSite::SetEnabled (bool enabled
 void
 BreakpointSite::AddOwner (const BreakpointLocationSP owner)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 m_owners.Add(owner);
 }
 
 size_t
 BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t 
break_loc_id)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 m_owners.Remove(break_id, break_loc_id);
 return m_owners.GetSize();
 }
@@ -182,21 +181,21 @@ BreakpointSite::RemoveOwner (lldb::break
 size_t
 BreakpointSite::GetNumberOfOwners ()
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 return m_owners.GetSize();
 }
 
 BreakpointLocationSP
 BreakpointSite::GetOwnerAtIndex (size_t index)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 return m_owners.GetByIndex (index);
 }
 
 bool
 BreakpointSite::ValidForThisThread (Thread *thread)
 {
-Mutex::Locker(m_owners_mutex);
+Mutex::Locker locker(m_owners_mutex);
 return m_owners.ValidForThisThread(thread);
 }
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r211289 - Switch over to using object_getClass to get the class of an object. Previously we were

2014-06-19 Thread Jim Ingham
Author: jingham
Date: Thu Jun 19 13:25:51 2014
New Revision: 211289

URL: http://llvm.org/viewvc/llvm-project?rev=211289view=rev
Log:
Switch over to using object_getClass to get the class of an object.  Previously 
we were
directly accessing the isa pointer of a class object to get its meta-class, but 
the isa
pointers are not simple pointers on arm64, so this would cause the stepping to 
fail.
object_getClass does whatever magic needs doing in this case.

rdar://problem/17239690

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=211289r1=211288r2=211289view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
 Thu Jun 19 13:25:51 2014
@@ -50,6 +50,7 @@ extern \C\
 {  
 \n\
 extern void *class_getMethodImplementation(void *objc_class, void *sel);   
 \n\
 extern void *class_getMethodImplementation_stret(void *objc_class, void 
*sel);  \n\
+extern void * object_getClass (id object); 
 \n\
 extern void * sel_getUid(char *name);  
 \n\
 extern int printf(const char *format, ...);
 \n\
 }  
 \n\
@@ -101,20 +102,25 @@ extern \C\ void * __lldb_objc_find_imp
 }  
 \n\
 else   
 \n\
 {  
 \n\
+// This code seems a little funny, but has its reasons...  
 \n\
+// The call to [object class] is here because if this is a class, and 
has not been called into  \n\
+// yet, we need to do something to force the class to initialize 
itself.\n\
+// Then the call to object_getClass will actually return the correct 
class, either the class\n\
+// if object is a class instance, or the meta-class if it is a class 
pointer.   \n\
 void *class_ptr = (void *) [(id) object class];
 \n\
-if (class_ptr == object)   
 \n\
+return_struct.class_addr = (id)  object_getClass((id) object); 
 \n\
+if (debug) 
 \n\
 {  
 \n\
-struct __lldb_objc_class *class_as_class_struct = (struct 
__lldb_objc_class *) class_ptr;   \n\
-if (debug) 
 \n\
-printf (\Found a class object, need to return the meta class 
0x%p - 0x%p\\n\,\n\
-class_ptr, class_as_class_struct-isa);
 \n\
-return_struct.class_addr = class_as_class_struct-isa; 
 \n\
-}  
 \n\
-else   
 \n\
-{  
 \n\
-if (debug) 
 \n\
-printf (\[object class] returned: 0x%p.\\n\, class_ptr); 
 \n\
-return_struct.class_addr = class_ptr;  
 \n\
+if (class_ptr == object)  

[Lldb-commits] [lldb] r211636 - Rework fix in r201744. You really DO need to waitpid twice to get the

2014-06-24 Thread Jim Ingham
Author: jingham
Date: Tue Jun 24 16:51:42 2014
New Revision: 211636

URL: http://llvm.org/viewvc/llvm-project?rev=211636view=rev
Log:
Rework fix in r201744.  You really DO need to waitpid twice to get the
process fully reaped.  The race  bad behavior was because we were letting
the reaping thread in LLDB to also set the Process exit status, so debugserver
would sometimes be shut down before it got a chance to report the exit status, 
and then we got confused.

rdar://problem/16555850

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/tools/debugserver/source/DNB.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=211636r1=211635r2=211636view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Jun 24 16:51:42 2014
@@ -824,9 +824,6 @@ public:
 bool
 MonitorProcess () const
 {
-if (GetFlags().Test(lldb::eLaunchFlagsDontMonitorProcess))
-return true;
-
 if (m_monitor_callback  ProcessIDIsValid())
 {
 Host::StartMonitoringChildProcess (m_monitor_callback,

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=211636r1=211635r2=211636view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Jun 24 16:51:42 2014
@@ -47,8 +47,8 @@ namespace lldb {
 eLaunchFlagLaunchInTTY  = (1u  5),  /// Launch the process in a new 
TTY if supported by the host 
 eLaunchFlagLaunchInShell= (1u  6),   /// Launch the process inside 
a shell to get shell expansion
 eLaunchFlagLaunchInSeparateProcessGroup = (1u  7), /// Launch the 
process in a separate process group
-eLaunchFlagsDontMonitorProcess = (1u  8)  /// If you are going to 
hand the process off (e.g. to debugserver)
-/// set this flag so lldb 
 the handee don't race to reap it.
+eLaunchFlagsDontSetExitStatus = (1u  8)  /// If you are going to 
hand the process off (e.g. to debugserver)
+/// set this flag so lldb 
 the handee don't race to set its exit status.
 } LaunchFlags;
 
 //--

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=211636r1=211635r2=211636view=diff
==
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Tue Jun 24 16:51:42 2014
@@ -1667,7 +1667,12 @@ Host::LaunchProcess (ProcessLaunchInfo 
 if (!launch_info.MonitorProcess())
 {
 const bool monitor_signals = false;
-StartMonitoringChildProcess (Process::SetProcessExitStatus, 
+Host::MonitorChildProcessCallback callback = nullptr;
+
+if 
(!launch_info.GetFlags().Test(lldb::eLaunchFlagsDontSetExitStatus))
+callback = Process::SetProcessExitStatus;
+
+StartMonitoringChildProcess (callback,
  NULL, 
  pid, 
  monitor_signals);

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=211636r1=211635r2=211636view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Tue Jun 24 
16:51:42 2014
@@ -785,10 +785,10 @@ PlatformDarwin::DebugProcess (ProcessLau
 
 if (IsHost())
 {
-// We are going to hand this process off to debugserver which will 
monitor the process itself.
-// So don't also monitor it from lldb or we set up a race between 
debugserver  us for who will find out
-// about the debugged process's death.
-launch_info.GetFlags().Set(eLaunchFlagsDontMonitorProcess);
+// We are going to hand this process off to debugserver which will be 
in charge of setting the exit status.
+// We still need to reap it from lldb but if we let the monitor thread 
also set the exit status, we set up a
+// race between debugserver  us for who 

[Lldb-commits] [lldb] r211903 - Revert the debugserver part of r211868. While formally a fine change, debugserver

2014-06-27 Thread Jim Ingham
Author: jingham
Date: Fri Jun 27 11:02:55 2014
New Revision: 211903

URL: http://llvm.org/viewvc/llvm-project?rev=211903view=rev
Log:
Revert the debugserver part of r211868.  While formally a fine change, 
debugserver
doesn't depend on llvm (it really doesn't even depend on anything in lldb) and 
this
nicety isn't worth adding that dependence.


Modified:
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/trunk/tools/debugserver/source/TTYState.h

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=211903r1=211902r2=211903view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Fri Jun 27 11:02:55 2014
@@ -47,7 +47,6 @@
 #include DNBTimer.h
 #include CFBundle.h
 
-#include llvm/ADT/STLExtras.h
 
 typedef std::shared_ptrMachProcess MachProcessSP;
 typedef std::mapnub_process_t, MachProcessSP ProcessMap;
@@ -543,7 +542,7 @@ GetAllInfos (std::vectorstruct kinfo_pr
 {
 size_t size = 0;
 int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
-u_int namelen = llvm::array_lengthof(name);
+u_int namelen = sizeof(name)/sizeof(int);
 int err;
 
 // Try to find out how many processes are around so we can

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=211903r1=211902r2=211903view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Fri Jun 27 
11:02:55 2014
@@ -20,8 +20,6 @@
 #include DNBThreadResumeActions.h
 #include MachProcess.h
 
-#include llvm/ADT/STLExtras.h
-
 MachThreadList::MachThreadList() :
 m_threads(),
 m_threads_mutex(PTHREAD_MUTEX_RECURSIVE),
@@ -315,7 +313,7 @@ MachThreadList::UpdateThreadList(MachPro
 int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 
process-ProcessID() };
 struct kinfo_proc processInfo;
 size_t bufsize = sizeof(processInfo);
-if (sysctl(mib, llvm::array_lengthof(mib), processInfo, bufsize, 
NULL, 0) == 0  bufsize  0)
+if (sysctl(mib, (unsigned)(sizeof(mib)/sizeof(int)), processInfo, 
bufsize, NULL, 0) == 0  bufsize  0)
 {
 if (processInfo.kp_proc.p_flag  P_LP64)
 m_is_64_bit = true;

Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=211903r1=211902r2=211903view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Fri Jun 27 
11:02:55 2014
@@ -23,8 +23,6 @@
 #include ARM_GCC_Registers.h
 #include ARM_DWARF_Registers.h
 
-#include llvm/ADT/STLExtras.h
-
 #include inttypes.h
 #include sys/sysctl.h
 
@@ -1557,9 +1555,9 @@ DNBArchMachARM::g_exc_registers[] =
 };
 
 // Number of registers in each register set
-const size_t DNBArchMachARM::k_num_gpr_registers = 
llvm::array_lengthof(g_gpr_registers);
-const size_t DNBArchMachARM::k_num_vfp_registers = 
llvm::array_lengthof(g_vfp_registers);
-const size_t DNBArchMachARM::k_num_exc_registers = 
llvm::array_lengthof(g_exc_registers);
+const size_t DNBArchMachARM::k_num_gpr_registers = 
sizeof(g_gpr_registers)/sizeof(DNBRegisterInfo);
+const size_t DNBArchMachARM::k_num_vfp_registers = 
sizeof(g_vfp_registers)/sizeof(DNBRegisterInfo);
+const size_t DNBArchMachARM::k_num_exc_registers = 
sizeof(g_exc_registers)/sizeof(DNBRegisterInfo);
 const size_t DNBArchMachARM::k_num_all_registers = k_num_gpr_registers + 
k_num_vfp_registers + k_num_exc_registers;
 
 //--
@@ -1576,7 +1574,7 @@ DNBArchMachARM::g_reg_sets[] =
 { Exception State Registers,  g_exc_registers,k_num_exc_registers
 }
 };
 // Total number of register sets for this architecture
-const size_t DNBArchMachARM::k_num_register_sets = 
llvm::array_lengthof(g_reg_sets);
+const size_t DNBArchMachARM::k_num_register_sets = 
sizeof(g_reg_sets)/sizeof(DNBRegisterSetInfo);
 
 
 const DNBRegisterSetInfo *

Modified: 

[Lldb-commits] [lldb] r212506 - If a hand-called function is interrupted by hitting a breakpoint, then

2014-07-07 Thread Jim Ingham
Author: jingham
Date: Mon Jul  7 20:07:32 2014
New Revision: 212506

URL: http://llvm.org/viewvc/llvm-project?rev=212506view=rev
Log:
If a hand-called function is interrupted by hitting a breakpoint, then 
when you continue to finish off the function call, the expression result
will be included as part of the thread stop info.

Added:
lldb/trunk/test/expression_command/call-function/TestCallStopAndContinue.py
Modified:
lldb/trunk/include/lldb/Target/StopInfo.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/include/lldb/Target/ThreadPlan.h
lldb/trunk/include/lldb/Target/ThreadPlanCallUserExpression.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
lldb/trunk/test/expression_command/call-function/main.cpp

Modified: lldb/trunk/include/lldb/Target/StopInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StopInfo.h?rev=212506r1=212505r2=212506view=diff
==
--- lldb/trunk/include/lldb/Target/StopInfo.h (original)
+++ lldb/trunk/include/lldb/Target/StopInfo.h Mon Jul  7 20:07:32 2014
@@ -157,7 +157,9 @@ public:
 CreateStopReasonToTrace (Thread thread);
 
 static lldb::StopInfoSP
-CreateStopReasonWithPlan (lldb::ThreadPlanSP plan, lldb::ValueObjectSP 
return_valobj_sp);
+CreateStopReasonWithPlan (lldb::ThreadPlanSP plan,
+  lldb::ValueObjectSP return_valobj_sp,
+  lldb::ClangExpressionVariableSP 
expression_variable_sp);
 
 static lldb::StopInfoSP
 CreateStopReasonWithException (Thread thread, const char *description);
@@ -168,6 +170,9 @@ public:
 static lldb::ValueObjectSP
 GetReturnValueObject (lldb::StopInfoSP stop_info_sp);
 
+static lldb::ClangExpressionVariableSP
+GetExpressionVariable (lldb::StopInfoSP stop_info_sp);
+
 protected:
 // Perform any action that is associated with this stop.  This is done as 
the
 // Event is removed from the event queue.  ProcessEventData::DoOnRemoval 
does the job.

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=212506r1=212505r2=212506view=diff
==
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Mon Jul  7 20:07:32 2014
@@ -966,6 +966,17 @@ public:
 GetReturnValueObject ();
 
 //--
+/// Gets the outer-most expression variable from the completed plans
+///
+/// @return
+/// A ClangExpressionVariableSP, either empty if there is no
+/// plan completed an expression during the current stop
+/// or the expression variable that was made for the completed 
expression.
+//--
+lldb::ClangExpressionVariableSP
+GetExpressionVariable ();
+
+//--
 ///  Checks whether the given plan is in the completed plans for this
 ///  stop.
 ///

Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=212506r1=212505r2=212506view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlan.h Mon Jul  7 20:07:32 2014
@@ -501,11 +501,26 @@ public:
 return m_thread.GetStopInfo ();
 }
 
+// If the completion of the thread plan stepped out of a function, the 
return value of the function
+// might have been captured by the thread plan (currently only 
ThreadPlanStepOut does this.)
+// If so, the ReturnValueObject can be retrieved from here.
+
 virtual lldb::ValueObjectSP
 GetReturnValueObject ()
 {
 return lldb::ValueObjectSP();
 }
+
+// If the thread plan managing the evaluation of a user expression lives 
longer than the command
+// that instigated the expression (generally because the expression 
evaluation hit a breakpoint, and
+// the user regained control at that point) a subsequent process control 
command step/continue/etc. might
+// complete the expression evaluations.  If so, the result of the 
expression evaluation will show up here.
+
+virtual lldb::ClangExpressionVariableSP
+GetExpressionVariable ()
+{
+return lldb::ClangExpressionVariableSP();
+}
 
 // If a thread plan stores the state before it was run, then you might
 // want to restore the state when it is done.  This will do 

[Lldb-commits] [lldb] r212507 - Add docs for the thread.completed-expression format entry.

2014-07-07 Thread Jim Ingham
Author: jingham
Date: Mon Jul  7 20:10:49 2014
New Revision: 212507

URL: http://llvm.org/viewvc/llvm-project?rev=212507view=rev
Log:
Add docs for the thread.completed-expression format entry.

Modified:
lldb/trunk/www/formats.html

Modified: lldb/trunk/www/formats.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/formats.html?rev=212507r1=212506r2=212507view=diff
==
--- lldb/trunk/www/formats.html (original)
+++ lldb/trunk/www/formats.html Mon Jul  7 20:10:49 2014
@@ -99,6 +99,7 @@
 tr valign=toptdbthread.queue/b/tdtdThe queue 
name of the thread if the target OS supports dispatch queues/td/tr
 tr valign=toptdbthread.stop-reason/b/tdtdA 
textual reason each thread stopped/td/tr
 tr valign=toptdbthread.return-value/b/tdtdThe 
return value of the latest step operation (currently only for 
step-out.)/td/tr
+tr 
valign=toptdbthread.completed-expression/b/tdtdThe expression result 
for a thread that just finished an interrupted expression evaluation./td/tr
 tr valign=toptdbtarget.arch/b/tdtdThe 
architecture of the current target/td/tr
 tr 
valign=toptdbtarget.script:ipython_func/i/b/tdtdUse a Python 
function to generate a piece of textual output/td/tr
 tr 
valign=toptdbprocess.script:ipython_func/i/b/tdtdUse a Python 
function to generate a piece of textual output/td/tr


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r212559 - Add the ability to provide a count option to the various thread step-* operations. Only

2014-07-08 Thread Jim Ingham
Author: jingham
Date: Tue Jul  8 14:28:57 2014
New Revision: 212559

URL: http://llvm.org/viewvc/llvm-project?rev=212559view=rev
Log:
Add the ability to provide a count option to the various thread step-* 
operations.  Only
step-inst and step-inst are currently supported, the rest just warn that they 
are not supported
if you try to provide a count.

Modified:
lldb/trunk/include/lldb/Target/ThreadPlan.h
lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=212559r1=212558r2=212559view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlan.h Tue Jul  8 14:28:57 2014
@@ -539,6 +539,27 @@ public:
 return false;
 }
 
+virtual bool
+SetIterationCount (size_t count)
+{
+if (m_takes_iteration_count)
+{
+// Don't tell me to do something 0 times...
+if (count == 0)
+return false;
+m_iteration_count = count;
+}
+return m_takes_iteration_count;
+}
+
+virtual size_t
+GetIterationCount ()
+{
+if (!m_takes_iteration_count)
+return 0;
+else
+return m_iteration_count;
+}
 protected:
 //--
 // Classes that inherit from ThreadPlan can see and modify these
@@ -593,6 +614,8 @@ protected:
 Thread m_thread;
 Vote m_stop_vote;
 Vote m_run_vote;
+bool m_takes_iteration_count = false;
+int32_t m_iteration_count = 1;
 
 private:
 //--

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h?rev=212559r1=212558r2=212559view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h Tue Jul  8 
14:28:57 2014
@@ -32,6 +32,7 @@ public:
 virtual lldb::StateType GetPlanRunState ();
 virtual bool WillStop ();
 virtual bool MischiefManaged ();
+virtual bool IsPlanStale ();
 
 protected:
 virtual bool DoPlanExplainsStop (Event *event_ptr);
@@ -41,6 +42,7 @@ protected:
bool stop_others,
Vote stop_vote,
Vote run_vote);
+void SetUpState ();
 
 private:
 friend lldb::ThreadPlanSP

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=212559r1=212558r2=212559view=diff
==
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Tue Jul  8 14:28:57 2014
@@ -371,6 +371,14 @@ public:
 }
 break;
 
+case 'c':
+{
+m_step_count = Args::StringToUInt32(option_arg, 
UINT32_MAX, 0);
+if (m_step_count == UINT32_MAX)
+   error.SetErrorStringWithFormat (invalid ignore count 
'%s', option_arg);
+break;
+}
+break;
 case 'm':
 {
 OptionEnumValueElement *enum_values = 
g_option_table[option_idx].enum_values; 
@@ -408,6 +416,7 @@ public:
 m_run_mode = eOnlyDuringStepping;
 m_avoid_regexp.clear();
 m_step_in_target.clear();
+m_step_count = 1;
 }
 
 const OptionDefinition*
@@ -426,6 +435,7 @@ public:
 RunMode m_run_mode;
 std::string m_avoid_regexp;
 std::string m_step_in_target;
+int32_t m_step_count;
 };
 
 CommandObjectThreadStepWithTypeAndScope (CommandInterpreter interpreter,
@@ -603,6 +613,14 @@ protected:
 {
 new_plan_sp-SetIsMasterPlan (true);
 new_plan_sp-SetOkayToDiscard (false);
+
+if (m_options.m_step_count  1)
+{
+if (new_plan_sp-SetIterationCount(m_options.m_step_count) != 
m_options.m_step_count)
+{
+result.AppendWarning (step operation does not support 
iteration count.);
+}
+}
 
 process-GetThreadList().SetSelectedThreadByID (thread-GetID());
 process-Resume ();
@@ -664,6 +682,7 @@ 

[Lldb-commits] [lldb] r213875 - We were turning off all these tests on OSX and FreeBSD because of a known (and fairly unimportant) bug.

2014-07-24 Thread Jim Ingham
Author: jingham
Date: Thu Jul 24 11:56:19 2014
New Revision: 213875

URL: http://llvm.org/viewvc/llvm-project?rev=213875view=rev
Log:
We were turning off all these tests on OSX and FreeBSD because of a known (and 
fairly unimportant) bug.  
Keep a test for that bug, but let the useful parts of the test run anyway.

Modified:

lldb/trunk/test/functionalities/thread/exit_during_step/TestExitDuringStep.py

Modified: 
lldb/trunk/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/exit_during_step/TestExitDuringStep.py?rev=213875r1=213874r2=213875view=diff
==
--- 
lldb/trunk/test/functionalities/thread/exit_during_step/TestExitDuringStep.py 
(original)
+++ 
lldb/trunk/test/functionalities/thread/exit_during_step/TestExitDuringStep.py 
Thu Jul 24 11:56:19 2014
@@ -15,13 +15,27 @@ class ExitDuringStepTestCase(TestBase):
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
 @expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
 @dsym_test
+def test_thread_state_is_stopped_with_dsym(self):
+Test thread exit during step handling.
+self.buildDsym(dictionary=self.getBuildFlags())
+self.thread_state_is_stopped()
+
+@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
+@expectedFailureFreeBSD(llvm.org/pr18190) # thread states not properly 
maintained
+@dwarf_test
+def test_thread_state_is_stopped_with_dwarf(self):
+Test thread exit during step handling.
+self.buildDwarf(dictionary=self.getBuildFlags())
+self.thread_state_is_stopped()
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@dsym_test
 def test_with_dsym(self):
 Test thread exit during step handling.
 self.buildDsym(dictionary=self.getBuildFlags())
 self.exit_during_step_inst_test()
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
-@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
 @dsym_test
 def test_step_over_with_dsym(self):
 Test thread exit during step-over handling.
@@ -29,31 +43,24 @@ class ExitDuringStepTestCase(TestBase):
 self.exit_during_step_over_test()
 
 @unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
-@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
 @dsym_test
 def test_step_in_with_dsym(self):
 Test thread exit during step-in handling.
 self.buildDsym(dictionary=self.getBuildFlags())
 self.exit_during_step_in_test()
 
-@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
-@expectedFailureFreeBSD(llvm.org/pr18190) # thread states not properly 
maintained
 @dwarf_test
 def test_with_dwarf(self):
 Test thread exit during step handling.
 self.buildDwarf(dictionary=self.getBuildFlags())
 self.exit_during_step_inst_test()
 
-@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
-@expectedFailureFreeBSD(llvm.org/pr18190) # thread states not properly 
maintained
 @dwarf_test
 def test_step_over_with_dwarf(self):
 Test thread exit during step-over handling.
 self.buildDwarf(dictionary=self.getBuildFlags())
 self.exit_during_step_over_test()
 
-@expectedFailureDarwin(llvm.org/pr15824) # thread states not properly 
maintained
-@expectedFailureFreeBSD(llvm.org/pr18190) # thread states not properly 
maintained
 @dwarf_test
 def test_step_in_with_dwarf(self):
 Test thread exit during step-in handling.
@@ -69,17 +76,21 @@ class ExitDuringStepTestCase(TestBase):
 
 def exit_during_step_inst_test(self):
 Test thread exit while using step-inst.
-self.exit_during_step_base(thread step-inst -m all-threads, 'stop 
reason = instruction step')
+self.exit_during_step_base(thread step-inst -m all-threads, 'stop 
reason = instruction step', False)
 
 def exit_during_step_over_test(self):
 Test thread exit while using step-over.
-self.exit_during_step_base(thread step-over -m all-threads, 'stop 
reason = step over')
+self.exit_during_step_base(thread step-over -m all-threads, 'stop 
reason = step over', False)
 
 def exit_during_step_in_test(self):
 Test thread exit while using step-in.
-self.exit_during_step_base(thread step-in -m all-threads, 'stop 
reason = step in')
+self.exit_during_step_base(thread step-in -m all-threads, 'stop 
reason = step in', False)
+
+def thread_state_is_stopped (self):
+Go to first point where all threads are stopped, and test that the 
thread state is correctly set.
+self.exit_during_step_base(thread step-in 

[Lldb-commits] [lldb] r214603 - After you attach, give the process plugin a chance to report back (through

2014-08-01 Thread Jim Ingham
Author: jingham
Date: Fri Aug  1 19:33:35 2014
New Revision: 214603

URL: http://llvm.org/viewvc/llvm-project?rev=214603view=rev
Log:
After you attach, give the process plugin a chance to report back (through
DidAttach) the architecture of the binary you attached to.

rdar://problem/17891396

Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=214603r1=214602r2=214603view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Aug  1 19:33:35 2014
@@ -1446,11 +1446,17 @@ public:
 //--
 /// Called after attaching a process.
 ///
+/// @param[in] process_arch
+/// If you can figure out the process architecture after attach, fill 
it in here.
+///
 /// Allow Process plug-ins to execute some code after attaching to
 /// a process.
 //--
 virtual void
-DidAttach () {}
+DidAttach (ArchSpec process_arch)
+{
+process_arch.Clear();
+}
 
 
 //--

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=214603r1=214602r2=214603view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Fri Aug  1 
19:33:35 2014
@@ -428,8 +428,10 @@ ProcessKDP::DoAttachToProcessWithName (c
 
 
 void
-ProcessKDP::DidAttach ()
+ProcessKDP::DidAttach (ArchSpec process_arch)
 {
+Process::DidAttach(process_arch);
+
 Log *log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS));
 if (log)
 log-Printf (ProcessKDP::DidAttach());

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=214603r1=214602r2=214603view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Fri Aug  1 
19:33:35 2014
@@ -105,7 +105,7 @@ public:
 DoAttachToProcessWithName (const char *process_name, const 
lldb_private::ProcessAttachInfo attach_info);
 
 virtual void
-DidAttach ();
+DidAttach (lldb_private::ArchSpec process_arch);
 
 lldb::addr_t
 GetImageInfoAddress();

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=214603r1=214602r2=214603view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Aug  
1 19:33:35 2014
@@ -1011,7 +1011,7 @@ ProcessGDBRemote::ConnectToDebugserver (
 }
 
 void
-ProcessGDBRemote::DidLaunchOrAttach ()
+ProcessGDBRemote::DidLaunchOrAttach (ArchSpec process_arch)
 {
 Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet 
(GDBR_LOG_PROCESS));
 if (log)
@@ -1022,16 +1022,17 @@ ProcessGDBRemote::DidLaunchOrAttach ()
 
 // See if the GDB server supports the qHostInfo information
 
-ArchSpec gdb_remote_arch = m_gdb_comm.GetHostArchitecture();
 
 // See if the GDB server supports the qProcessInfo packet, if so
 // prefer that over the Host information as it will be more specific
 // to our process.
 
 if (m_gdb_comm.GetProcessArchitecture().IsValid())
-gdb_remote_arch = m_gdb_comm.GetProcessArchitecture();
+process_arch = m_gdb_comm.GetProcessArchitecture();
+else
+process_arch = m_gdb_comm.GetHostArchitecture();
 
-if (gdb_remote_arch.IsValid())
+if (process_arch.IsValid())
 {
 ArchSpec target_arch = GetTarget().GetArchitecture();
 
@@ -1044,15 +1045,15 @@ ProcessGDBRemote::DidLaunchOrAttach ()
 // it has, so we really need to take the remote host 
architecture as our
 // defacto 

[Lldb-commits] [lldb] r214836 - Add some useful logging to the step log.

2014-08-04 Thread Jim Ingham
Author: jingham
Date: Mon Aug  4 20:58:14 2014
New Revision: 214836

URL: http://llvm.org/viewvc/llvm-project?rev=214836view=rev
Log:
Add some useful logging to the step log.

Modified:
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=214836r1=214835r2=214836view=diff
==
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Mon Aug  4 20:58:14 2014
@@ -318,7 +318,7 @@ protected:
 
 if (thread_sp)
 {
-Log *log = lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_BREAKPOINTS);
+Log *log = lldb_private::GetLogIfAnyCategoriesSet 
(LIBLLDB_LOG_BREAKPOINTS | LIBLLDB_LOG_STEP);
 
 if (!thread_sp-IsValid())
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r214837 - If you found a step through plan stop looking up the stack for a step out plan.

2014-08-04 Thread Jim Ingham
Author: jingham
Date: Mon Aug  4 20:59:20 2014
New Revision: 214837

URL: http://llvm.org/viewvc/llvm-project?rev=214837view=rev
Log:
If you found a step through plan stop looking up the stack for a step out plan.

Modified:
lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=214837r1=214836r2=214837view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Mon Aug  4 20:59:20 
2014
@@ -185,6 +185,9 @@ ThreadPlanStepOverRange::ShouldStop (Eve
 else
 {
 new_plan_sp = m_thread.QueueThreadPlanForStepThrough 
(m_stack_id, false, stop_others);
+// If we found a way through, then we should stop recursing.
+if (new_plan_sp)
+break;
 }
 }
 }


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r214941 - Probably should initialize that new ivar while I'm at it...

2014-08-05 Thread Jim Ingham
Author: jingham
Date: Tue Aug  5 19:24:38 2014
New Revision: 214941

URL: http://llvm.org/viewvc/llvm-project?rev=214941view=rev
Log:
Probably should initialize that new ivar while I'm at it...

Modified:
lldb/trunk/source/Interpreter/CommandObject.cpp

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=214941r1=214940r2=214941view=diff
==
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Aug  5 19:24:38 2014
@@ -56,6 +56,7 @@ CommandObject::CommandObject
 m_is_alias (false),
 m_flags (flags),
 m_arguments(),
+m_deprecated_command_override_callback (nullptr),
 m_command_override_callback (nullptr),
 m_command_override_baton (nullptr)
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r214946 - When stepping, handle the case where the step leaves us with

2014-08-05 Thread Jim Ingham
Author: jingham
Date: Tue Aug  5 20:49:59 2014
New Revision: 214946

URL: http://llvm.org/viewvc/llvm-project?rev=214946view=rev
Log:
When stepping, handle the case where the step leaves us with
the same parent frame, but different current frame - e.g. when
you step past a tail call exit from a function.  Apply the same
avoid-no-debug rules to this case as for a step-in.

rdar://problem/16189225

Modified:
lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h?rev=214946r1=214945r2=214946view=diff
==
--- lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h Tue Aug  5 20:49:59 
2014
@@ -77,6 +77,7 @@ protected:
 std::vectorAddressRange m_address_ranges;
 lldb::RunMode m_stop_others;
 StackID   m_stack_id;// Use the stack ID so we can 
tell step out from step in.
+StackID   m_parent_stack_id; // Use the parent stack ID so 
we can identify tail calls and the like.
 bool  m_no_more_plans;   // Need this one so we can 
tell if we stepped into a call,
  // but can't continue, in 
which case we are done.
 bool  m_first_run_event; // We want to broadcast only 
one running event, our first.

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=214946r1=214945r2=214946view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Aug  5 20:49:59 2014
@@ -682,14 +682,22 @@ namespace lldb {
 } TypeOptions;
 
//--
-   // This is the return value for frame comparisons.  When frame A pushes
-   // frame B onto the stack, frame A is OLDER than frame B.
+   // This is the return value for frame comparisons.  If you are comparing 
frame A to frame B
+   // the following cases arise:
+   // 1) When frame A pushes frame B (or a frame that ends up pushing B) A is 
Older than B.
+   // 2) When frame A pushed frame B (or if frame A is on the stack but B is 
not) A is Younger than B
+   // 3) When frame A and frame B have the same StackID, they are Equal.
+   // 4) When frame A and frame B have the same immediate parent frame, but 
are not equal, the comparision yields
+   //SameParent.
+   // 5) If the two frames are on different threads or processes the 
comparision is Invalid
+   // 6) If for some reason we can't figure out what went on, we return 
Unknown.
//--
typedef enum FrameComparison
{
eFrameCompareInvalid,
eFrameCompareUnknown,
eFrameCompareEqual,
+   eFrameCompareSameParent,
eFrameCompareYounger,
eFrameCompareOlder
} FrameComparison;

Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=214946r1=214945r2=214946view=diff
==
--- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Tue Aug  5 20:49:59 
2014
@@ -82,7 +82,8 @@ ThreadPlanShouldStopHere::DefaultShouldS
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
 
 if ((operation == eFrameCompareOlder  flags.Test(eStepOutAvoidNoDebug))
-|| (operation == eFrameCompareYounger  
flags.Test(eStepInAvoidNoDebug)))
+|| (operation == eFrameCompareYounger  
flags.Test(eStepInAvoidNoDebug))
+|| (operation == eFrameCompareSameParent  
flags.Test(eStepInAvoidNoDebug)))
 {
 if (!frame-HasDebugInformation())
 {

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=214946r1=214945r2=214946view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Tue Aug  5 20:49:59 2014
@@ -190,7 +190,7 @@ ThreadPlanStepInRange::ShouldStop (Event
 
 

[Lldb-commits] [lldb] r215411 - Fetching the parent frame may fail, handle that case. Patch from Tong Shen.

2014-08-11 Thread Jim Ingham
Author: jingham
Date: Mon Aug 11 18:57:43 2014
New Revision: 215411

URL: http://llvm.org/viewvc/llvm-project?rev=215411view=rev
Log:
Fetching the parent frame may fail, handle that case.  Patch from Tong Shen.

Modified:
lldb/trunk/source/Target/ThreadPlanStepRange.cpp
lldb/trunk/source/Target/ThreadPlanStepUntil.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=215411r1=215410r2=215411view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Mon Aug 11 18:57:43 2014
@@ -58,7 +58,9 @@ ThreadPlanStepRange::ThreadPlanStepRange
 m_use_fast_step = GetTarget().GetUseFastStepping();
 AddRange(range);
 m_stack_id = m_thread.GetStackFrameAtIndex(0)-GetStackID();
-m_parent_stack_id = m_thread.GetStackFrameAtIndex(1)-GetStackID();
+StackFrameSP parent_stack = m_thread.GetStackFrameAtIndex(1);
+if (parent_stack)
+  m_parent_stack_id = parent_stack-GetStackID();
 }
 
 ThreadPlanStepRange::~ThreadPlanStepRange ()
@@ -272,7 +274,10 @@ ThreadPlanStepRange::CompareCurrentFrame
 }
 else
 {
-StackID cur_parent_id = m_thread.GetStackFrameAtIndex(1)-GetStackID();
+StackFrameSP cur_parent_frame = m_thread.GetStackFrameAtIndex(1);
+StackID cur_parent_id;
+if (cur_parent_frame)
+  cur_parent_id = cur_parent_frame-GetStackID();
 if (m_parent_stack_id.IsValid()
  cur_parent_id.IsValid()
  m_parent_stack_id == cur_parent_id)

Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=215411r1=215410r2=215411view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Mon Aug 11 18:57:43 2014
@@ -77,7 +77,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
 }
 }
 
-m_stack_id = m_thread.GetStackFrameAtIndex(frame_idx)-GetStackID();
+m_stack_id = frame_sp-GetStackID();
 
 // Now set breakpoints on all our return addresses:
 for (size_t i = 0; i  num_addresses; i++)


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r216637 - Make it clear in the help that breakpoint command add will act on the last set

2014-08-27 Thread Jim Ingham
Author: jingham
Date: Wed Aug 27 19:50:17 2014
New Revision: 216637

URL: http://llvm.org/viewvc/llvm-project?rev=216637view=rev
Log:
Make it clear in the help that breakpoint command add will act on the last set
breakpoint if no breakpoint id is specified.

rdar://problem/17885160

Modified:
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=216637r1=216636r2=216637view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Wed Aug 27 
19:50:17 2014
@@ -44,7 +44,8 @@ public:
 CommandObjectBreakpointCommandAdd (CommandInterpreter interpreter) :
 CommandObjectParsed (interpreter,
  add,
- Add a set of commands to a breakpoint, to be 
executed whenever the breakpoint is hit.,
+ Add a set of commands to a breakpoint, to be 
executed whenever the breakpoint is hit.
+   If no breakpoint is specified, adds the 
commands to the last created breakpoint.,
  NULL),
 IOHandlerDelegateMultiline (DONE, 
IOHandlerDelegate::Completion::LLDBCommand),
 m_options (interpreter)
@@ -193,7 +194,7 @@ one command per line.\n );
 
 // Define the first (and only) variant of this arg.
 bp_id_arg.arg_type = eArgTypeBreakpointID;
-bp_id_arg.arg_repetition = eArgRepeatPlain;
+bp_id_arg.arg_repetition = eArgRepeatOptional;
 
 // There is only one variant this argument could be; put it into the 
argument entry.
 arg.push_back (bp_id_arg);


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r216747 - Allow breakpoint command add to add commands to more than one breakpoint at a time.

2014-08-29 Thread Jim Ingham
Author: jingham
Date: Fri Aug 29 12:34:17 2014
New Revision: 216747

URL: http://llvm.org/viewvc/llvm-project?rev=216747view=rev
Log:
Allow breakpoint command add to add commands to more than one breakpoint at a 
time.

rdar://problem/13314462

Modified:
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=216747r1=216746r2=216747view=diff
==
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Aug 29 12:34:17 
2014
@@ -372,7 +372,7 @@ public:
 }
 
 virtual void 
-CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+CollectDataForBreakpointCommandCallback (std::vectorBreakpointOptions * 
options,
  CommandReturnObject result);
 
 virtual void 
@@ -380,6 +380,10 @@ public:
  CommandReturnObject result);
 
 /// Set the specified text as the callback for the breakpoint.
+Error
+SetBreakpointCommandCallback (std::vectorBreakpointOptions * 
bp_options_vec,
+  const char *callback_text);
+
 virtual Error
 SetBreakpointCommandCallback (BreakpointOptions *bp_options,
   const char *callback_text)
@@ -389,6 +393,10 @@ public:
 return error;
 }
 
+void
+SetBreakpointCommandCallbackFunction (std::vectorBreakpointOptions * 
bp_options_vec,
+  const char *function_name);
+
 /// Set a one-liner as the callback for the breakpoint.
 virtual void 
 SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=216747r1=216746r2=216747view=diff
==
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Fri Aug 29 
12:34:17 2014
@@ -225,7 +225,7 @@ public:
 AcquireInterpreterLock ();
 
 void
-CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
+CollectDataForBreakpointCommandCallback (std::vectorBreakpointOptions * 
bp_options_vec,
  CommandReturnObject result);
 
 void 

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=216747r1=216746r2=216747view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Fri Aug 29 
12:34:17 2014
@@ -47,7 +47,7 @@ public:
  Add a set of commands to a breakpoint, to be 
executed whenever the breakpoint is hit.
If no breakpoint is specified, adds the 
commands to the last created breakpoint.,
  NULL),
-IOHandlerDelegateMultiline (DONE, 
IOHandlerDelegate::Completion::LLDBCommand),
+IOHandlerDelegateMultiline (DONE, 
IOHandlerDelegate::Completion::LLDBCommand),
 m_options (interpreter)
 {
 SetHelpLong (
@@ -229,9 +229,12 @@ one command per line.\n );
 {
 io_handler.SetIsDone(true);
 
-BreakpointOptions *bp_options = (BreakpointOptions *) 
io_handler.GetUserData();
-if (bp_options)
+std::vectorBreakpointOptions * *bp_options_vec = 
(std::vectorBreakpointOptions * *)io_handler.GetUserData();
+for (BreakpointOptions *bp_options : *bp_options_vec)
 {
+if (!bp_options)
+continue;
+
 std::unique_ptrBreakpointOptions::CommandData data_ap(new 
BreakpointOptions::CommandData());
 if (data_ap.get())
 {
@@ -240,36 +243,37 @@ one command per line.\n );
 bp_options-SetCallback (BreakpointOptionsCallbackFunction, 
baton_sp);
 }
 }
-
 }
 
 void
-CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options, 
+

[Lldb-commits] [lldb] r217719 - ResolveUsername should resolve ~ to the user's home directory as well as ~/. This

2014-09-12 Thread Jim Ingham
Author: jingham
Date: Fri Sep 12 17:59:05 2014
New Revision: 217719

URL: http://llvm.org/viewvc/llvm-project?rev=217719view=rev
Log:
ResolveUsername should resolve ~ to the user's home directory as well as 
~/.  This 
gets command-line file completion from ~ working again.

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=217719r1=217718r2=217719view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Sep 12 17:59:05 2014
@@ -66,9 +66,9 @@ FileSpec::ResolveUsername (llvm::SmallVe
 
 llvm::StringRef path_str(path.data());
 size_t slash_pos = path_str.find_first_of(/, 1);
-if (slash_pos == 1)
+if (slash_pos == 1 || path_str.size() == 1)
 {
-// A path of the form ~/ resolves to the current user's home dir
+// A path of the form ~ or ~/ resolves to the current user's home dir
 llvm::SmallString64 home_dir;
 if (!llvm::sys::path::home_directory(home_dir))
 return;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r217722 - Don't make paths with /Foo//bar, that confuses everybody down the line.

2014-09-12 Thread Jim Ingham
Author: jingham
Date: Fri Sep 12 18:39:38 2014
New Revision: 217722

URL: http://llvm.org/viewvc/llvm-project?rev=217722view=rev
Log:
Don't make paths with /Foo//bar, that confuses everybody down the line.
This gets the file completer for absolute paths working again.

Modified:
lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=217722r1=217721r2=217722view=diff
==
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Sep 12 18:39:38 2014
@@ -946,6 +946,8 @@ FileSpec::EnumerateDirectory
 lldb_utility::CleanUp DIR *, int dir_path_dir(opendir(dir_path), 
NULL, closedir);
 if (dir_path_dir.is_valid())
 {
+char dir_path_last_char = dir_path[strlen(dir_path) - 1];
+
 long path_max = fpathconf (dirfd (dir_path_dir.get()), 
_PC_NAME_MAX);
 #if defined (__APPLE_)  defined (__DARWIN_MAXPATHLEN)
 if (path_max  __DARWIN_MAXPATHLEN)
@@ -990,7 +992,14 @@ FileSpec::EnumerateDirectory
 if (call_callback)
 {
 char child_path[PATH_MAX];
-const int child_path_len = ::snprintf (child_path, 
sizeof(child_path), %s/%s, dir_path, dp-d_name);
+
+// Don't make paths with /foo//bar, that just confuses 
everybody.
+int child_path_len;
+if (dir_path_last_char == '/')
+child_path_len = ::snprintf (child_path, 
sizeof(child_path), %s%s, dir_path, dp-d_name);
+else
+child_path_len = ::snprintf (child_path, 
sizeof(child_path), %s/%s, dir_path, dp-d_name);
+
 if (child_path_len  (int)(sizeof(child_path) - 1))
 {
 // Don't resolve the file type or path


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218156 - We had to squirrel away the dyld module before doing ResolveExecutableModule, since

2014-09-19 Thread Jim Ingham
Author: jingham
Date: Fri Sep 19 16:56:45 2014
New Revision: 218156

URL: http://llvm.org/viewvc/llvm-project?rev=218156view=rev
Log:
We had to squirrel away the dyld module before doing ResolveExecutableModule, 
since
that would clear the module list, and then put it back by hand.  But we forgot 
to 
also put its sections back in the target SectionList, so we would jettison it as
unloaded when we finished handling the first real load event.  Add its sections.

rdar://problem/18385947

Modified:

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=218156r1=218155r2=218156view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
Fri Sep 19 16:56:45 2014
@@ -1350,7 +1350,13 @@ DynamicLoaderMacOSXDYLD::UpdateImageInfo
 
get_dependent_images);
 
 if (dyld_module_sp)
-target.GetImages().AppendIfNeeded (dyld_module_sp);
+{
+   if(target.GetImages().AppendIfNeeded (dyld_module_sp))
+   {
+// Also add it to the section list.
+UpdateImageLoadAddress(dyld_module_sp.get(), m_dyld);
+   }
+}
 }
 }
 }


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218157 - Fix a thinko in how the RemoteiOS Platform looked up files in the SDK other

2014-09-19 Thread Jim Ingham
Author: jingham
Date: Fri Sep 19 16:58:45 2014
New Revision: 218157

URL: http://llvm.org/viewvc/llvm-project?rev=218157view=rev
Log:
Fix a thinko in how the RemoteiOS Platform looked up files in the SDK  other
platform locations.  We didn't always do an exhaustive search through all the 
platform locations, so we would have to read some files out of memory even 
though
they existed in the exploded shared cache or SDK.

rdar://problem/18385947

Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=218157r1=218156r2=218157view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Fri Sep 19 
16:58:45 2014
@@ -688,84 +688,70 @@ PlatformRemoteiOS::GetSharedModule (cons
 
 FileSpec local_file;
 const UUID *module_uuid_ptr = module_spec.GetUUIDPtr();
-Error error (GetSymbolFile (platform_file, module_uuid_ptr, local_file));
-if (error.Success())
+Error error;
+char platform_file_path[PATH_MAX];
+
+if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
 {
-error = ResolveExecutable (local_file, module_spec.GetArchitecture(), 
module_sp, NULL);
-if (module_sp  ((module_uuid_ptr == NULL) || (module_sp-GetUUID() 
== *module_uuid_ptr)))
-{
-//printf (found in user specified SDK\n);
-error.Clear();
-return error;
-}
-
-char platform_file_path[PATH_MAX];
-if (platform_file.GetPath(platform_file_path, 
sizeof(platform_file_path)))
+FileSpec local_file;
+const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+// Try the last SDK index if it is set as most files from an SDK
+// will tend to be valid in that same SDK.
+if (m_last_module_sdk_idx  num_sdk_infos)
 {
-FileSpec local_file;
-const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
-// Try the last SDK index if it is set as most files from an SDK
-// will tend to be valid in that same SDK.
-if (m_last_module_sdk_idx  num_sdk_infos)
+if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, 
local_file))
 {
-if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, 
local_file))
+//printf (sdk[%u] last: '%s'\n, m_last_module_sdk_idx, 
local_file.GetPath().c_str());
+module_sp.reset();
+error = ResolveExecutable (local_file,
+   module_spec.GetArchitecture(),
+   module_sp,
+   NULL);
+if (module_sp  ((module_uuid_ptr == NULL) || 
(module_sp-GetUUID() == *module_uuid_ptr)))
 {
-//printf (sdk[%u] last: '%s'\n, m_last_module_sdk_idx, 
local_file.GetPath().c_str());
-module_sp.reset();
-error = ResolveExecutable (local_file,
-   module_spec.GetArchitecture(),
-   module_sp,
-   NULL);
-if (module_sp  ((module_uuid_ptr == NULL) || 
(module_sp-GetUUID() == *module_uuid_ptr)))
-{
-//printf (sdk[%u] last found\n, 
m_last_module_sdk_idx);
-error.Clear();
-return error;
-}
+//printf (sdk[%u] last found\n, m_last_module_sdk_idx);
+error.Clear();
+return error;
 }
 }
-
-// First try for an exact match of major, minor and update
-for (uint32_t sdk_idx=0; sdk_idxnum_sdk_infos; ++sdk_idx)
+}
+
+// First try for an exact match of major, minor and update
+for (uint32_t sdk_idx=0; sdk_idxnum_sdk_infos; ++sdk_idx)
+{
+if (m_last_module_sdk_idx == sdk_idx)
 {
-if (m_last_module_sdk_idx == sdk_idx)
-{
-// Skip the last module SDK index if we already searched
-// it above
-continue;
-}
-if (GetFileInSDK (platform_file_path, sdk_idx, local_file))
+// Skip the last module SDK index if we already searched
+// it above
+continue;
+}
+if (GetFileInSDK (platform_file_path, sdk_idx, local_file))
+{
+ 

Re: [Lldb-commits] [PATCH] Very minimal non-8-bit byte support for diverse kalimba architectures

2014-09-26 Thread Jim Ingham
Greg is out on vacation for a week.  This looks fairly straightforward.  There 
used to be architectures with weird byte sizes like 9 or 12 bits - gdb had some 
support for this.  Choosing to express the number of bits per byte as a 
multiple of 8 makes it impossible to support this situation.  OTOH I'm not sure 
how much that matters now-a-days.

Jim

http://reviews.llvm.org/D5503



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218642 - This checkin is the first step in making the lldb thread stepping mechanism more accessible from

2014-09-29 Thread Jim Ingham
Author: jingham
Date: Mon Sep 29 18:17:18 2014
New Revision: 218642

URL: http://llvm.org/viewvc/llvm-project?rev=218642view=rev
Log:
This checkin is the first step in making the lldb thread stepping mechanism 
more accessible from
the user level.  It adds the ability to invent new stepping modes implemented 
by python classes,
and to view the current thread plan stack and to some extent alter it.

I haven't gotten to documentation or tests yet.  But this should not cause any 
behavior changes
if you don't use it, so its safe to check it in now and work on it 
incrementally.

Added:
lldb/trunk/include/lldb/API/SBThreadPlan.h
lldb/trunk/include/lldb/Target/ThreadPlanPython.h
lldb/trunk/scripts/Python/interface/SBThreadPlan.i
lldb/trunk/source/API/SBThreadPlan.cpp
lldb/trunk/source/Target/ThreadPlanPython.cpp
Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBDefines.h
lldb/trunk/include/lldb/API/SBEvent.h
lldb/trunk/include/lldb/API/SBStream.h
lldb/trunk/include/lldb/API/SBThread.h
lldb/trunk/include/lldb/Expression/ClangFunction.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/include/lldb/Target/ThreadPlan.h
lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h
lldb/trunk/include/lldb/lldb-private-enumerations.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/scripts/Python/build-swig-Python.sh
lldb/trunk/scripts/Python/interface/SBThread.i
lldb/trunk/scripts/Python/python-swigsafecast.swig
lldb/trunk/scripts/Python/python-wrapper.swig
lldb/trunk/scripts/lldb.swig
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/API/SBEvent.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
lldb/trunk/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
lldb/trunk/source/Target/ThreadPlanStepOut.cpp
lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=218642r1=218641r2=218642view=diff
==
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Mon Sep 29 18:17:18 2014
@@ -117,6 +117,7 @@ protected:
 friend class SBSymbolContext;
 friend class SBTarget;
 friend class SBThread;
+friend class SBThreadPlan;
 friend class SBValue;
 friend class SBQueueItem;
 

Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=218642r1=218641r2=218642view=diff
==
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Mon Sep 29 18:17:18 2014
@@ -71,6 +71,7 @@ class LLDB_API SBSymbolContextList;
 class LLDB_API SBTarget;
 class LLDB_API SBThread;
 class LLDB_API SBThreadCollection;
+class LLDB_API SBThreadPlan;
 class LLDB_API SBType;
 class LLDB_API SBTypeCategory;
 class LLDB_API SBTypeEnumMember;

Modified: lldb/trunk/include/lldb/API/SBEvent.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=218642r1=218641r2=218642view=diff
==
--- lldb/trunk/include/lldb/API/SBEvent.h (original)
+++ lldb/trunk/include/lldb/API/SBEvent.h Mon Sep 29 18:17:18 2014
@@ -30,6 +30,10 @@ public:
 // Make an event that contains a C string.
 SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len);
 
+SBEvent (lldb::EventSP event_sp);
+
+SBEvent (lldb_private::Event *event_sp);
+
 ~SBEvent();
 
 const SBEvent 
@@ -77,8 +81,6 @@ protected:
 friend class SBThread;
 friend class SBWatchpoint;
 
-SBEvent (lldb::EventSP event_sp);
-
 lldb::EventSP 
 GetSP () const;
 

Modified: lldb/trunk/include/lldb/API/SBStream.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=218642r1=218641r2=218642view=diff
==
--- lldb/trunk/include/lldb/API/SBStream.h (original)
+++ lldb/trunk/include/lldb/API/SBStream.h Mon Sep 29 18:17:18 2014
@@ 

[Lldb-commits] [lldb] r218656 - Fix some errors that crept in when I cut pasted into emacs.

2014-09-29 Thread Jim Ingham
Author: jingham
Date: Mon Sep 29 20:37:52 2014
New Revision: 218656

URL: http://llvm.org/viewvc/llvm-project?rev=218656view=rev
Log:
Fix some errors that crept in when I cut  pasted into emacs.

Modified:
lldb/trunk/examples/python/scripted_step.py

Modified: lldb/trunk/examples/python/scripted_step.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/scripted_step.py?rev=218656r1=218655r2=218656view=diff
==
--- lldb/trunk/examples/python/scripted_step.py (original)
+++ lldb/trunk/examples/python/scripted_step.py Mon Sep 29 20:37:52 2014
@@ -86,7 +86,7 @@ class SimpleStep:
 def __init__ (self, thread_plan, dict):
 self.thread_plan = thread_plan
 self.start_address = thread_plan.GetThread().GetFrameAtIndex(0).GetPC()
-
+
 def explains_stop (self, event):
 # We are stepping, so if we stop for any other reason, it isn't
 # because of us.
@@ -94,13 +94,13 @@ class SimpleStep:
 return True
 else:
 return False
-
+
 def should_stop (self, event):
 cur_pc = self.thread_plan.GetThread().GetFrameAtIndex(0).GetPC()
-
+
 if cur_pc  self.start_address or cur_pc = self.start_address + 20:
 self.thread_plan.SetPlanComplete(True)
-return True
+return True
 else:
 return False
 
@@ -109,22 +109,22 @@ class SimpleStep:
 
 class StepWithPlan:
 def__init__ (self,thread_plan, dict):
-self.thread_plan = thread_plan
-self.start_address = 
thread_plan.GetThread().GetFrameAtIndex(0).GetPCAddress()
-self.step_thread_plan 
=thread_plan.QueueThreadPlanForStepOverRange(self.start_address, 20);
-
-defexplains_stop (self, event):
-# Since all I'm doing is running a plan, I will only ever get askedthis
-# if myplan doesn't explain the stop, and in that caseI don'teither.
+self.thread_plan = thread_plan
+self.start_address = 
thread_plan.GetThread().GetFrameAtIndex(0).GetPCAddress()
+self.step_thread_plan 
=thread_plan.QueueThreadPlanForStepOverRange(self.start_address, 20);
+
+def explains_stop (self, event):
+# Since all I'm doing is running a plan, I will only ever get askedthis
+# if myplan doesn't explain the stop, and in that caseI don'teither.
 return False
 
-defshould_stop (self, event):
-if self.step_thread_plan.IsPlanComplete():
+def should_stop (self, event):
+if self.step_thread_plan.IsPlanComplete():
 self.thread_plan.SetPlanComplete(True)
 return True
-else:
-return False
+else:
+return False
 
-defshould_step (self):
-return False
+def should_step (self):
+return False
 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218687 - Add SBThreadPlan to this CMakeLists.txt as well.

2014-09-30 Thread Jim Ingham
Author: jingham
Date: Tue Sep 30 12:11:53 2014
New Revision: 218687

URL: http://llvm.org/viewvc/llvm-project?rev=218687view=rev
Log:
Add SBThreadPlan to this CMakeLists.txt as well.

Modified:
lldb/trunk/source/CMakeLists.txt

Modified: lldb/trunk/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=218687r1=218686r2=218687view=diff
==
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Tue Sep 30 12:11:53 2014
@@ -258,6 +258,7 @@ add_lldb_library(liblldb
   API/SBSymbolContextList.cpp
   API/SBTarget.cpp
   API/SBThread.cpp
+  API/SBThreadPlan.cpp
   API/SBThreadCollection.cpp
   API/SBType.cpp
   API/SBTypeCategory.cpp


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218699 - Not all processes have a Dynamic Loader. Be sure to check that it exists before using it.

2014-09-30 Thread Jim Ingham
Author: jingham
Date: Tue Sep 30 15:33:25 2014
New Revision: 218699

URL: http://llvm.org/viewvc/llvm-project?rev=218699view=rev
Log:
Not all processes have a Dynamic Loader.  Be sure to check that it exists 
before using it.

rdar://problem/18491391

Modified:
lldb/trunk/source/Target/ThreadPlanStepThrough.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=218699r1=218698r2=218699view=diff
==
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Tue Sep 30 15:33:25 2014
@@ -87,7 +87,10 @@ ThreadPlanStepThrough::DidPush ()
 void
 ThreadPlanStepThrough::LookForPlanToStepThroughFromCurrentPC()
 {
-m_sub_plan_sp = 
m_thread.GetProcess()-GetDynamicLoader()-GetStepThroughTrampolinePlan 
(m_thread, m_stop_others);
+DynamicLoader *loader = m_thread.GetProcess()-GetDynamicLoader();
+if (loader)
+m_sub_plan_sp = loader-GetStepThroughTrampolinePlan (m_thread, 
m_stop_others);
+
 // If that didn't come up with anything, try the ObjC runtime plugin:
 if (!m_sub_plan_sp.get())
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r218837 - Add SBExecutionContext.cpp to this file as well, as the comment

2014-10-01 Thread Jim Ingham
Author: jingham
Date: Wed Oct  1 17:26:52 2014
New Revision: 218837

URL: http://llvm.org/viewvc/llvm-project?rev=218837view=rev
Log:
Add SBExecutionContext.cpp to this file as well, as the comment
in source/API/CMakeLists.txt instructs...

Modified:
lldb/trunk/source/CMakeLists.txt

Modified: lldb/trunk/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=218837r1=218836r2=218837view=diff
==
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Wed Oct  1 17:26:52 2014
@@ -233,6 +233,7 @@ add_lldb_library(liblldb
   API/SBDeclaration.cpp
   API/SBError.cpp
   API/SBEvent.cpp
+  API/SBExecutionContext.cpp
   API/SBExpressionOptions.cpp
   API/SBFileSpec.cpp
   API/SBFileSpecList.cpp


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Add target.jit-args settings

2014-10-06 Thread Jim Ingham
It's ugly to have to add quotes and then remove them, but until we write our 
own option parser I can't think of a better way to do it...

Jim

http://reviews.llvm.org/D5472



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r219979 - Add a test for the -b (batch mode) option to the lldb driver.

2014-10-16 Thread Jim Ingham
Author: jingham
Date: Thu Oct 16 18:02:14 2014
New Revision: 219979

URL: http://llvm.org/viewvc/llvm-project?rev=219979view=rev
Log:
Add a test for the -b (batch mode) option to the lldb driver.

Added:
lldb/trunk/test/driver/
lldb/trunk/test/driver/batch_mode/
lldb/trunk/test/driver/batch_mode/Makefile
lldb/trunk/test/driver/batch_mode/TestBatchMode.py
lldb/trunk/test/driver/batch_mode/main.c
Modified:
lldb/trunk/test/lldbtest.py

Added: lldb/trunk/test/driver/batch_mode/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/driver/batch_mode/Makefile?rev=219979view=auto
==
--- lldb/trunk/test/driver/batch_mode/Makefile (added)
+++ lldb/trunk/test/driver/batch_mode/Makefile Thu Oct 16 18:02:14 2014
@@ -0,0 +1,28 @@
+CC ?= clang
+ifeq $(ARCH) 
+   ARCH = x86_64
+endif
+
+ifeq $(OS) 
+   OS = $(shell uname -s)
+endif
+
+CFLAGS ?= -g -O0
+CWD := $(shell pwd)
+
+LIB_PREFIX := lib
+
+ifeq $(OS) Darwin
+   CFLAGS += -arch $(ARCH)
+endif
+
+all: a.out
+
+a.out: main.o
+   $(CC) $(CFLAGS) -o a.out main.o
+
+main.o: main.c
+   $(CC) $(CFLAGS) -c main.c
+
+clean:
+   rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM)

Added: lldb/trunk/test/driver/batch_mode/TestBatchMode.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/driver/batch_mode/TestBatchMode.py?rev=219979view=auto
==
--- lldb/trunk/test/driver/batch_mode/TestBatchMode.py (added)
+++ lldb/trunk/test/driver/batch_mode/TestBatchMode.py Thu Oct 16 18:02:14 2014
@@ -0,0 +1,99 @@
+
+Test that the lldb driver's batch mode works correctly.
+
+
+import os, time
+import unittest2
+import lldb
+import pexpect
+from lldbtest import *
+
+class DriverBatchModeTest (TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@unittest2.expectedFailure(rdar://problem/18684124, lldb doesn't 
reliably print the prompt when run under pexpect)
+@dsym_test
+def test_driver_batch_mode_with_dsym(self):
+Test that the lldb driver's batch mode works correctly.
+self.buildDsym()
+self.setTearDownCleanup()
+self.batch_mode ()
+
+@unittest2.expectedFailure(rdar://problem/18684124, lldb doesn't 
reliably print the prompt when run under pexpect)
+@dwarf_test
+def test_driver_batch_mode_with_dwarf(self):
+Test that the lldb driver's batch mode works correctly.
+self.buildDwarf()
+self.setTearDownCleanup()
+self.batch_mode()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Our simple source filename.
+self.source = 'main.c'
+
+def expect_string (self, string):
+This expects for string, with timeout  EOF being test fails.
+try:
+self.child.expect_exact(string)
+except pexpect.EOF:
+self.fail (Got EOF waiting for '%s'%(string))
+except pexpect.TIMEOUT:
+self.fail (Timed out waiting for '%s'%(string))
+
+
+def batch_mode (self):
+exe = os.path.join(os.getcwd(), a.out)
+prompt = (lldb) 
+
+# First time through, pass CRASH so the process will crash and stop in 
batch mode.
+run_commands = ' -b -o break set -n main -o run -o continue '
+self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (self.lldbHere, 
self.lldbOption, run_commands, exe))
+child = self.child
+# Turn on logging for what the child sends back.
+if self.TraceOn():
+child.logfile_read = sys.stdout
+
+# We should see the run:
+self.expect_string (run)
+# We should have hit the breakpoint  continued:
+self.expect_string (continue)
+# The App should have crashed:
+self.expect_string(About to crash)
+# Then we should have a live prompt:
+self.expect_string (prompt)
+self.child.sendline(frame variable touch_me_not)
+self.expect_string ('(char *) touch_me_not')
+
+self.deletePexpectChild()
+
+# Now do it again, and see make sure if we don't crash, we quit:
+run_commands = ' -b -o break set -n main -o run -o continue '
+self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (self.lldbHere, 
self.lldbOption, run_commands, exe))
+child = self.child
+# Turn on logging for what the child sends back.
+if self.TraceOn():
+child.logfile_read = sys.stdout
+
+# We should see the run:
+self.expect_string (run)
+# We should have hit the breakpoint  continued:
+self.expect_string (continue)
+# The App should have not have crashed:
+self.expect_string(Got there on time and it did not crash.)
+# Then we should have a live prompt:
+

Re: [Lldb-commits] [PATCH] Add an OperatingSystem plugin to support goroutines

2014-10-20 Thread Jim Ingham
Greg should comment on way you're populating the Memory threads, etc.  That was 
his code (used mostly by the OS X kernel folks to turn kernel thread 
activations into lldb threads...)  At present you can only enable/disable the 
OS plugins when the target is created, but I haven't looked into how hard that 
would be to change.

But anyway most of the extensions (like the JIT loader and the ASAN plugin) do 
their initialization work by inserting some callback in:

Process::ModulesDidLoad

which gets called every time a new shared library is loaded.  You can just 
check the module list you were passed and if it contains the symbol you are 
looking for, run your Init method.  At some point we should create some formal 
process where plugins can register new module loaded handlers rather than 
just jamming them in here by hand.  If you are feeling ambitious, have a go!  
Otherwise, just do what everybody else does...

Jim

http://reviews.llvm.org/D5871



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r220358 - The breakpoint location hit counts were getting incremented in

2014-10-21 Thread Jim Ingham
Author: jingham
Date: Tue Oct 21 20:54:17 2014
New Revision: 220358

URL: http://llvm.org/viewvc/llvm-project?rev=220358view=rev
Log:
The breakpoint location hit counts were getting incremented in
BreakpointLocation::ShouldStop.  That worked but wasn't really right,
since there's nothing to guarantee that won't get called more than
once.  So this change moves that responsibility to the StopInfoBreakpoint
directly, and then it uses the BreakpointSite to actually do the bumping.

Also fix a test case that was assuming if you had many threads running some 
code with a breakpoint in it, the hit count when you stopped would always be
1.  Many of the threads could have hit it at the same time...

rdar://problem/18577603

Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp
lldb/trunk/source/Breakpoint/BreakpointSite.cpp
lldb/trunk/source/Target/StopInfo.cpp
lldb/trunk/test/functionalities/attach_resume/TestAttachResume.py

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=220358r1=220357r2=220358view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue Oct 21 20:54:17 
2014
@@ -387,6 +387,7 @@ public:
 bool EquivalentToLocation(BreakpointLocation location);
 
 protected:
+friend class BreakpointSite;
 friend class BreakpointLocationList;
 friend class Process;
 
@@ -413,6 +414,9 @@ private:
 void
 SwapLocation (lldb::BreakpointLocationSP swap_from);
 
+void
+BumpHitCount();
+
 
 //--
 // Constructors and Destructors

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=220358r1=220357r2=220358view=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Tue Oct 21 20:54:17 2014
@@ -259,6 +259,12 @@ public:
 private:
 friend class Process;
 friend class BreakpointLocation;
+// The StopInfoBreakpoint knows when it is processing a hit for a thread 
for a site, so let it be the
+// one to manage setting the location hit count once and only once.
+friend class StopInfoBreakpoint;
+
+void
+BumpHitCounts();
 
 //--
 /// The method removes the owner at \a break_loc_id from this breakpoint 
list.

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=220358r1=220357r2=220358view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Tue Oct 21 20:54:17 2014
@@ -449,8 +449,7 @@ BreakpointLocation::ShouldStop (Stoppoin
 bool should_stop = true;
 Log *log = lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_BREAKPOINTS);
 
-IncrementHitCount();
-
+// Do this first, if a location is disabled, it shouldn't increment its 
hit count.
 if (!IsEnabled())
 return false;
 
@@ -474,6 +473,13 @@ BreakpointLocation::ShouldStop (Stoppoin
 return should_stop;
 }
 
+void
+BreakpointLocation::BumpHitCount()
+{
+if (IsEnabled())
+IncrementHitCount();
+}
+
 bool
 BreakpointLocation::IsResolved () const
 {

Modified: lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp?rev=220358r1=220357r2=220358view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp Tue Oct 21 
20:54:17 2014
@@ -196,3 +196,4 @@ BreakpointLocationCollection::GetDescrip
 (*pos)-GetDescription(s, level);
 }
 }
+

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=220358r1=220357r2=220358view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Tue Oct 21 20:54:17 2014
@@ -199,6 +199,15 @@ 

[Lldb-commits] [lldb] r220602 - Setting breakpoints with name mask eFunctionNameTypeBase was broken for straight C names by 220432. Get

2014-10-24 Thread Jim Ingham
Author: jingham
Date: Fri Oct 24 19:33:55 2014
New Revision: 220602

URL: http://llvm.org/viewvc/llvm-project?rev=220602view=rev
Log:
Setting breakpoints with name mask eFunctionNameTypeBase was broken for 
straight C names by 220432.  Get
that working again.


Modified:
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/CPPLanguageRuntime.cpp

Modified: lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h?rev=220602r1=220601r2=220602view=diff
==
--- lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h Fri Oct 24 19:33:55 2014
@@ -132,9 +132,16 @@ public:
 
 static bool
 IsCPPMangledName(const char *name);
-
+
+// Extract C++ context and identifier from a string using heuristic 
matching (as opposed to
+// CPPLanguageRuntime::MethodName which has to have a fully qualified C++ 
name with parens and arguments.
+// If the name is a lone C identifier (e.g. C) or a qualified C identifier 
(e.g. A::B::C) it will return true,
+// and identifier will be the identifier (C and C respectively) and the 
context will be  and A::B:: respectively.
+// If the name fails the heuristic matching for a qualified or unqualified 
C/C++ identifier, then it will return false
+// and identifier and context will be unchanged.
+
 static bool
-StripNamespacesFromVariableName (const char *name, const char 
*base_name_start, const char *base_name_end);
+ExtractContextAndIdentifier (const char *name, llvm::StringRef context, 
llvm::StringRef identifier);
 
 // in some cases, compilers will output different names for one same type. 
when that happens, it might be impossible
 // to construct SBType objects for a valid type, because the name that is 
available is not the same as the name that

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=220602r1=220601r2=220602view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Oct 24 19:33:55 2014
@@ -1710,8 +1710,9 @@ Module::PrepareForFunctionNameLookup (co
 const char *name_cstr = name.GetCString();
 lookup_name_type_mask = eFunctionNameTypeNone;
 match_name_after_lookup = false;
-const char *base_name_start = NULL;
-const char *base_name_end = NULL;
+
+llvm::StringRef basename;
+llvm::StringRef context;
 
 if (name_type_mask  eFunctionNameTypeAuto)
 {
@@ -1725,18 +1726,16 @@ Module::PrepareForFunctionNameLookup (co
 lookup_name_type_mask |= eFunctionNameTypeSelector;
 
 CPPLanguageRuntime::MethodName cpp_method (name);
-llvm::StringRef basename (cpp_method.GetBasename());
+basename = cpp_method.GetBasename();
 if (basename.empty())
 {
-if (CPPLanguageRuntime::StripNamespacesFromVariableName 
(name_cstr, base_name_start, base_name_end))
+if (CPPLanguageRuntime::ExtractContextAndIdentifier 
(name_cstr, context, basename))
 lookup_name_type_mask |= (eFunctionNameTypeMethod | 
eFunctionNameTypeBase);
 else
 lookup_name_type_mask = eFunctionNameTypeFull;
 }
 else
 {
-base_name_start = basename.data();
-base_name_end = base_name_start + basename.size();
 lookup_name_type_mask |= (eFunctionNameTypeMethod | 
eFunctionNameTypeBase);
 }
 }
@@ -1751,9 +1750,7 @@ Module::PrepareForFunctionNameLookup (co
 CPPLanguageRuntime::MethodName cpp_method (name);
 if (cpp_method.IsValid())
 {
-llvm::StringRef basename (cpp_method.GetBasename());
-base_name_start = basename.data();
-base_name_end = base_name_start + basename.size();
+basename = cpp_method.GetBasename();
 
 if (!cpp_method.GetQualifiers().empty())
 {
@@ -1766,12 +1763,9 @@ Module::PrepareForFunctionNameLookup (co
 }
 else
 {
-if (!CPPLanguageRuntime::StripNamespacesFromVariableName 
(name_cstr, base_name_start, base_name_end))
-{
-lookup_name_type_mask = ~(eFunctionNameTypeMethod | 
eFunctionNameTypeBase);
-if (lookup_name_type_mask == eFunctionNameTypeNone)
-return;
-}
+// If the CPP method parser didn't manage to chop 

[Lldb-commits] [lldb] r220743 - Add a test for setting and hitting the C++ Exception throw breakpoint.

2014-10-27 Thread Jim Ingham
Author: jingham
Date: Mon Oct 27 19:53:20 2014
New Revision: 220743

URL: http://llvm.org/viewvc/llvm-project?rev=220743view=rev
Log:
Add a test for setting and hitting the C++ Exception throw breakpoint.

Added:
lldb/trunk/test/functionalities/breakpoint/cpp_exception/
lldb/trunk/test/functionalities/breakpoint/cpp_exception/Makefile

lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
lldb/trunk/test/functionalities/breakpoint/cpp_exception/main.cpp

Added: lldb/trunk/test/functionalities/breakpoint/cpp_exception/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp_exception/Makefile?rev=220743view=auto
==
--- lldb/trunk/test/functionalities/breakpoint/cpp_exception/Makefile (added)
+++ lldb/trunk/test/functionalities/breakpoint/cpp_exception/Makefile Mon Oct 
27 19:53:20 2014
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py?rev=220743view=auto
==
--- 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
 (added)
+++ 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
 Mon Oct 27 19:53:20 2014
@@ -0,0 +1,58 @@
+
+Test that you can set breakpoint and hit the C++ language exception breakpoint
+
+
+import os
+import re
+import unittest2
+import lldb, lldbutil
+import sys
+from lldbtest import *
+
+class TestCPPExceptionBreakpoint (TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+my_var = 10
+
+@unittest2.skipUnless(sys.platform.startswith(darwin), requires Darwin)
+@python_api_test
+@dsym_test
+def test_cpp_exception_breakpoint (self):
+Test setting and hitting the C++ exception breakpoint.
+self.buildDsym()
+self.do_cpp_exception_bkpt ()
+
+@python_api_test
+@dwarf_test
+def test_cpp_exception_breakpoint_with_dwarf(self):
+Test setting and hitting the C++ exception breakpoint.
+self.buildDwarf()
+self.do_cpp_exception_bkpt ()
+
+def setUp (self):
+TestBase.setUp(self)
+self.main_source = main.c
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+
+
+def do_cpp_exception_bkpt (self):
+exe = os.path.join(os.getcwd(), a.out)
+error = lldb.SBError()
+
+self.target = self.dbg.CreateTarget(exe)
+self.assertTrue(self.target, VALID_TARGET)
+
+exception_bkpt = 
self.target.BreakpointCreateForException(lldb.eLanguageTypeC_plus_plus, False, 
True)
+self.assertTrue (exception_bkpt.IsValid(), Created exception 
breakpoint.)
+
+process = self.target.LaunchSimple (None, None, 
self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+
+thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, 
exception_bkpt)
+self.assertTrue (len(thread_list) == 1, One thread stopped at the 
exception breakpoint.)
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()

Added: lldb/trunk/test/functionalities/breakpoint/cpp_exception/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp_exception/main.cpp?rev=220743view=auto
==
--- lldb/trunk/test/functionalities/breakpoint/cpp_exception/main.cpp (added)
+++ lldb/trunk/test/functionalities/breakpoint/cpp_exception/main.cpp Mon Oct 
27 19:53:20 2014
@@ -0,0 +1,13 @@
+#include exception
+
+void
+throws_int ()
+{
+throw 5;
+}
+
+int
+main ()
+{
+throws_int();
+}


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


  1   2   3   >