[Lldb-commits] [PATCH] D54385: Remove comments after header includes.

2018-11-11 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Do we also want to get rid of the `// C Includes` comments that are in some 
files? LLVM isn't using them either and just removing lines doesn't make git 
blame more complicated.




Comment at: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp:38
 #include "Plugins/Process/Utility/InstructionUtils.h"
-#include "Plugins/Process/Utility/RegisterContext_mips.h" //mips32 has same 
registers nos as mips64
 

Just FYI: That's not one of the 'for X' kind of comments like the rest, but it 
also seems of redundant so let's also remove it.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54385



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44060: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a comment.

Ping.


https://reviews.llvm.org/D44060



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a reviewer: aprantl.
kubamracek added a comment.

Ping.


https://reviews.llvm.org/D44081



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D44073: [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a reviewer: aprantl.
kubamracek added a comment.

Ping.


https://reviews.llvm.org/D44073



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a reviewer: aprantl.
kubamracek added a comment.

Ping.


https://reviews.llvm.org/D43884



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54385: Remove comments after header includes.

2018-11-11 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In https://reviews.llvm.org/D54385#1294534, @teemperor wrote:

> Do we also want to get rid of the `// C Includes` comments that are in some 
> files? LLVM isn't using them either and just removing lines doesn't make git 
> blame more complicated.


Yup, I'll do that in a follow up!


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54385



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D43886: [lldb] Add GetCurrentException and GetCurrentExceptionBacktrace APIs to SBThread

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek updated this revision to Diff 173603.
kubamracek added a comment.

Updating patch for the recently-landed StackFrameRecognizers.


https://reviews.llvm.org/D43886

Files:
  include/lldb/API/SBThread.h
  include/lldb/Target/StackFrameRecognizer.h
  include/lldb/Target/Thread.h
  source/API/SBThread.cpp
  source/Commands/CommandObjectThread.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  source/Target/StackFrameRecognizer.cpp
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -29,6 +29,7 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrameRecognizer.h"
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/SystemRuntime.h"
 #include "lldb/Target/Target.h"
@@ -2190,3 +2191,18 @@
   }
   return error;
 }
+
+ValueObjectSP Thread::GetCurrentException() {
+  StackFrameSP frame_sp(GetStackFrameAtIndex(0));
+  if (!frame_sp) return ValueObjectSP();
+
+  RecognizedStackFrameSP recognized_frame(frame_sp->GetRecognizedFrame());
+  if (!recognized_frame) return ValueObjectSP();
+
+  return recognized_frame->GetExceptionObject();
+}
+
+ThreadSP Thread::GetCurrentExceptionBacktrace() {
+  // TODO
+  return ThreadSP();
+}
Index: source/Target/StackFrameRecognizer.cpp
===
--- source/Target/StackFrameRecognizer.cpp
+++ source/Target/StackFrameRecognizer.cpp
@@ -53,8 +53,8 @@
 
 class StackFrameRecognizerManagerImpl {
 public:
-  void AddRecognizer(StackFrameRecognizerSP recognizer, ConstString &module,
- ConstString &symbol, bool first_instruction_only) {
+  void AddRecognizer(StackFrameRecognizerSP recognizer, const ConstString &module,
+ const ConstString &symbol, bool first_instruction_only) {
 m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, false, module, RegularExpressionSP(),
   symbol, RegularExpressionSP(),
   first_instruction_only});
@@ -156,7 +156,7 @@
 }
 
 void StackFrameRecognizerManager::AddRecognizer(
-StackFrameRecognizerSP recognizer, ConstString &module, ConstString &symbol,
+StackFrameRecognizerSP recognizer, const ConstString &module, const ConstString &symbol,
 bool first_instruction_only) {
   GetStackFrameRecognizerManagerImpl().AddRecognizer(recognizer, module, symbol,
  first_instruction_only);
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -29,6 +29,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Core/ValueObjectConstResult.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Expression/DiagnosticManager.h"
 #include "lldb/Expression/FunctionCaller.h"
@@ -43,10 +44,12 @@
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/ABI.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrameRecognizer.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/ConstString.h"
@@ -377,6 +380,8 @@
   }
 }
 
+static void RegisterObjCExceptionRecognizer();
+
 AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
const ModuleSP &objc_module_sp)
 : AppleObjCRuntime(process), m_get_class_info_code(),
@@ -397,6 +402,7 @@
   static const ConstString g_gdb_object_getClass("gdb_object_getClass");
   m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(
g_gdb_object_getClass, eSymbolTypeCode) != NULL);
+  RegisterObjCExceptionRecognizer();
 }
 
 bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
@@ -2596,3 +2602,57 @@
   } else
 this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false);
 }
+
+#pragma mark Frame recognizers
+
+class ObjCExceptionRecognizedStackFrame : public RecognizedStackFrame {
+ public:
+  ObjCExceptionRecognizedStackFrame(StackFrameSP frame_sp) {
+ThreadSP thread_sp = frame_sp->GetThread();
+ProcessSP process_sp = thread_sp->GetProcess();
+
+const lldb::ABISP &abi = process_sp->GetABI();
+if (!abi) return;
+
+CompilerType voidstar = process_sp->GetTarget()
+.GetScratchClangASTContext()
+  

[Lldb-commits] [PATCH] D43886: [lldb] Add GetCurrentException and GetCurrentExceptionBacktrace APIs to SBThread

2018-11-11 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a comment.

Hi, I've updated this patch after a while. Since then, StackFrameRecognizers 
have already landed, so this patch now just adds one subclass of a 
StackFrameRecognizer.

> It seems however like providing some interesting ValueObjects is a pretty 
> common thing to do, so maybe it would be better to have an API like:
>  `ValueObjectSP GetValueObjectOfKind(const char *kind);`

For now, I've kept the new method, `GetExceptionObject()`. If you'd still like 
me to change it into a string-based API, let me know, I'll be happy to change 
it. I agree that it doesn't make sense to keep adding methods to the base 
RecognizedStackFrame class.

> Maybe it would be better to change --extended to take an enum, and then do:
>  `thread backtrace --extended exception`

I can add that. On top of the backtrace, the exception has a class name and 
message (at least in Obj-C), which is also important to present via some 
command. Do you want to keep `thread exception` as well? Or make `thread 
backtrace -e exception` be the only way to access the class+message of an 
exception?


https://reviews.llvm.org/D43886



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits