[Lldb-commits] [PATCH] D115723: [lldb] Fix ABIMacOSX_arm64::PrepareTrivialCall logging

2021-12-14 Thread Augusto Noronha via Phabricator via lldb-commits
augusto2112 created this revision.
Herald added subscribers: pengfei, kristof.beyls.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Make the logging message print ABIMacOSX_arm64 instead of ABISysV_x86_64.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115723

Files:
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp


Index: lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
===
--- lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -86,7 +86,7 @@
   eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
 
   // x0 - x7 contain first 8 simple args
-  if (args.size() > 8) // TODO handle more than 8 arguments
+  if (args.size() > 8) // TODO handle more than 6 arguments
 return false;
 
   for (size_t i = 0; i < args.size(); ++i) {
@@ -402,7 +402,7 @@
 // volatile (and specifically only the lower 8 bytes of these regs), the rest
 // of the fp/SIMD registers are volatile.
 //
-// v. https://github.com/ARM-software/abi-aa/blob/main/aapcs64/
+// v. https://github.com/ARM-software/abi-aa/blob/master/aapcs64/
 
 // We treat x29 as callee preserved also, else the unwinder won't try to
 // retrieve fp saves.
@@ -817,16 +817,6 @@
 
 lldb::addr_t ABIMacOSX_arm64::FixAddress(addr_t pc, addr_t mask) {
   lldb::addr_t pac_sign_extension = 0x0080ULL;
-  // Darwin systems originally couldn't determine the proper value
-  // dynamically, so the most common value was hardcoded.  This has
-  // largely been cleaned up, but there are still a handful of
-  // environments that assume the default value is set to this value
-  // and there's no dynamic value to correct it.
-  // When no mask is specified, set it to 39 bits of addressing (0..38).
-  if (mask == 0) {
-// ~((1ULL<<39)-1)
-mask = 0xff80;
-  }
   return (pc & pac_sign_extension) ? pc | mask : pc & (~mask);
 }
 
@@ -838,3 +828,12 @@
 void ABIMacOSX_arm64::Terminate() {
   PluginManager::UnregisterPlugin(CreateInstance);
 }
+
+// PluginInterface protocol
+
+ConstString ABIMacOSX_arm64::GetPluginNameStatic() {
+  static ConstString g_plugin_name("ABIMacOSX_arm64");
+  return g_plugin_name;
+}
+
+uint32_t ABIMacOSX_arm64::GetPluginVersion() { return 1; }


Index: lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
===
--- lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -86,7 +86,7 @@
   eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
 
   // x0 - x7 contain first 8 simple args
-  if (args.size() > 8) // TODO handle more than 8 arguments
+  if (args.size() > 8) // TODO handle more than 6 arguments
 return false;
 
   for (size_t i = 0; i < args.size(); ++i) {
@@ -402,7 +402,7 @@
 // volatile (and specifically only the lower 8 bytes of these regs), the rest
 // of the fp/SIMD registers are volatile.
 //
-// v. https://github.com/ARM-software/abi-aa/blob/main/aapcs64/
+// v. https://github.com/ARM-software/abi-aa/blob/master/aapcs64/
 
 // We treat x29 as callee preserved also, else the unwinder won't try to
 // retrieve fp saves.
@@ -817,16 +817,6 @@
 
 lldb::addr_t ABIMacOSX_arm64::FixAddress(addr_t pc, addr_t mask) {
   lldb::addr_t pac_sign_extension = 0x0080ULL;
-  // Darwin systems originally couldn't determine the proper value
-  // dynamically, so the most common value was hardcoded.  This has
-  // largely been cleaned up, but there are still a handful of
-  // environments that assume the default value is set to this value
-  // and there's no dynamic value to correct it.
-  // When no mask is specified, set it to 39 bits of addressing (0..38).
-  if (mask == 0) {
-// ~((1ULL<<39)-1)
-mask = 0xff80;
-  }
   return (pc & pac_sign_extension) ? pc | mask : pc & (~mask);
 }
 
@@ -838,3 +828,12 @@
 void ABIMacOSX_arm64::Terminate() {
   PluginManager::UnregisterPlugin(CreateInstance);
 }
+
+// PluginInterface protocol
+
+ConstString ABIMacOSX_arm64::GetPluginNameStatic() {
+  static ConstString g_plugin_name("ABIMacOSX_arm64");
+  return g_plugin_name;
+}
+
+uint32_t ABIMacOSX_arm64::GetPluginVersion() { return 1; }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D115723: [lldb] Fix ABIMacOSX_arm64::PrepareTrivialCall logging

2021-12-14 Thread Augusto Noronha via Phabricator via lldb-commits
augusto2112 abandoned this revision.
augusto2112 added a comment.

Looks like this was already fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115723/new/

https://reviews.llvm.org/D115723

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


[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added subscribers: zequanwu, labath.
labath added a comment.

I don't have any issues with this per se, but you may want to sync up with 
@zequanwu, as his D115308  tries to delete 
the second instance.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115662/new/

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D115126: [LLDB] Add unit tests for Editline keyboard shortcuts

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/include/lldb/Host/Editline.h:392-393
+
+  friend class EditlineKeyboardBindingTest_MultiLineEditlineKeybindings_Test;
+  friend class EditlineKeyboardBindingTest_SingleLineEditlineKeybindings_Test;
 };

nealsid wrote:
> labath wrote:
> > This also isn't something we normally do. I'd recommend just making a 
> > function like `DumpKeyBindings()` or something. It's true that it would 
> > only be used in tests right now, but I can imagine some day adding an lldb 
> > command to dump current bindings, so it does not seem completely out of 
> > place. If you wanted to, you could even add it right now and do your test 
> > that way.
> Can you clarify this? I see a lot of friend class declarations in the LLDB 
> codebase, both prod and test.
> 
> A command to dump key bindings could be useful in the future, but the 
> requirement of parsing editline's stdout and manipulating it into some sort 
> of structure for an API sounds like a maintenance tax until that command is 
> implemented.
We have a lot (too many) of friend declarations, but I'm not aware of any case 
where a production class befriends a test class (particularly one with a 
gtest-generated name). I know we sometimes make things `protected` (even though 
they could be `private`) for the sake of testing. That approach would also work 
here, but I think the new function would be better.

I didn't mean to parse the generated output. The function basically just be a 
wrapper for `el_set(el, EL_BIND, nullptr)` (I'm assuming that output is 
suitable for human consumption). The lldb command would then just call this 
function when invoked.



Comment at: lldb/unittests/Editline/EditlineTest.cpp:133-139
+  // We have to set the output stream we pass to Editline as not using
+  // buffered I/O.  Otherwise we are missing editline's output when we
+  // close the stream in the keybinding test (i.e. the EOF comes
+  // before data previously written to the stream by editline).  This
+  // behavior isn't as I understand the spec becuse fclose should
+  // flush the stream, but my best guess is that it's some unexpected
+  // interaction with stream I/O and ptys.

nealsid wrote:
> labath wrote:
> > nealsid wrote:
> > > labath wrote:
> > > > I find this hard to believe. I think it's more likely that this is 
> > > > working around some problem in the test itself. I can't say what is the 
> > > > precise problem without more investigation, but for example the 
> > > > synchronization around testOutputBuffer seems inadequate. 
> > > > `GetEditlineOutput` could deadlock if the read thread reads the newline 
> > > > before it reaches the `wait` call. It also does not handle spurious 
> > > > wakeups. And the accesses to testOutputBuffer are completely 
> > > > thread-unsafe.
> > > I spent a few hours on this before sending the initial patch; it may be 
> > > some interaction with the file APIs and the Psuedoterminal class we have 
> > > in LLVM.  I could not debug anything it was doing that was leading to 
> > > this behavior, but reliably saw EOF being sent before data that had been 
> > > written to the stream.  I also tried various things like flushing it 
> > > manually, which did not work, but sleeping before closing the secondary 
> > > FD enabled all data to be read on the test side.  If you have some time, 
> > > I'd be happy to have a gchat or screen sharing session and see if we can 
> > > brainstorm something.
> > > 
> > > Regarding the synchronization, good call; I built on top of the existing 
> > > threading, which did not require synchronizing reading the output of 
> > > editline, because the actual output was never used.  Now, I just call 
> > > provide a method to call thread::join for tests that need to read the 
> > > output to ensure it's all been written.  
> > Well.. I tried running this locally, and the test passed just fine even 
> > with this code deleted. I don't think we should commit code like this 
> > without understanding the problem in more detail. (Like, if it's a problem 
> > with llvm code, then lets fix that; if it's a problem with libc code (I 
> > doubt that), then let's file a bug before working around it.)If you want to 
> > discuss this in a more interactive fashion, you can find me on the `#lldb` 
> > channel @ irc.oftc.net.
> Cool, I'll take another look..what platform were you running on? 
It was x86_64-linux glibc-2.33 kernel-5.10.



Comment at: lldb/unittests/Editline/EditlineTest.cpp:345
+  // mapped back to a specific input.
+  const std::string testNumber;
+  // Whether this keyboard shortcut is only bound in multi-line mode.

nealsid wrote:
> labath wrote:
> > nealsid wrote:
> > > labath wrote:
> > > > You already have a const on the variable declaration. You don't need to 
> > > > put one on every member as well.
> > > I like const on the struct fields since it expresses th

[Lldb-commits] [PATCH] D114911: [lldb] Introduce a FreeBSDKernel plugin for vmcores

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Seems reasonable. I mean, there are a lot of things that are less than ideal, 
but none of this is substantially worse than what we have already, and you've 
done a pretty good job explaining what you've done.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114911/new/

https://reviews.llvm.org/D114911

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


[Lldb-commits] [PATCH] D115324: Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

2021-12-14 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115324/new/

https://reviews.llvm.org/D115324

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


[Lldb-commits] [PATCH] D115324: Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

The patch is slightly larger than I would prefer for a through review, but 
here's my first pass at it. I appreciate the difficulties in bootstrapping 
something like this incrementally, but I do see at least a couple of 
opportunities to make things smaller. I think the DataEncoder, FileSystem, 
Symbol, and Mangled changes could go into separate patch(es). I don't know if 
it's feasible to separate the construction of the symtab cache content, from 
the actual act of storing it in the cache, but if those two processes could be 
separated, it would help things a lot.




Comment at: lldb/source/Host/common/FileSystem.cpp:523
+  Status error;
+  if (IsDirectory(path))
+error.SetErrorStringWithFormatv("\"{0}\" is a directory",

What's the purpose of this check ?



Comment at: lldb/source/Symbol/Symbol.cpp:645
+  file.AppendU16(m_type_data);
+  file.AppendU16((&m_type_data)[1]);
+  m_mangled.Encode(file, strtab);

This is quite dodgy. It would be better to change the storage so that we don't 
have to do this. Perhaps something like
```
union {
  uint16_t flag_storage;
  struct {
uint16_t m_type_data_resolved : 1;
...
  };
};
```



Comment at: lldb/source/Symbol/Symtab.cpp:1220
+
+static const llvm::StringRef kIdentifierCStrMap("CMAP");
+

constexpr llvm::StringLiteral



Comment at: lldb/source/Symbol/Symtab.cpp:1256
+
+#define CURRENT_CACHE_VERSION 1
+/// The encoding format for the symbol table is as follows:

constexpr uint32_t



Comment at: lldb/source/Symbol/Symtab.cpp:1278-1282
+// No object file, this case is used for unit testing only.
+CacheSignature signature;
+signature.m_mod_time = 123;
+if (!signature.Encode(encoder))
+  return false;

I am troubled by code like this. Have you tried creating a mock object file in 
the test?



Comment at: lldb/source/Symbol/Symtab.cpp:1364
+const uint8_t num_cstr_maps = data.GetU8(offset_ptr);
+for (uint8_t i=0; i m) {
+if (m_take_ownership)

`[&]` on a lambda that outlives the enclosing function is dangerous.



Comment at: lldb/source/Utility/DataFileCache.cpp:61-64
+std::string error = toString(cache_or_err.takeError());
+LLDB_LOG(log,
+ "failed to create lldb index cache directory \"{0}\": {1}",
+ path, error);

there's an LLDB_LOG_ERROR macro for this


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115324/new/

https://reviews.llvm.org/D115324

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


[Lldb-commits] [lldb] ebb6bb7 - [lldb/python] Plug SBStructuredData leaks

2021-12-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-12-14T17:02:24+01:00
New Revision: ebb6bb725eadd57a0f7995fff17774020f6f0389

URL: 
https://github.com/llvm/llvm-project/commit/ebb6bb725eadd57a0f7995fff17774020f6f0389
DIFF: 
https://github.com/llvm/llvm-project/commit/ebb6bb725eadd57a0f7995fff17774020f6f0389.diff

LOG: [lldb/python] Plug SBStructuredData leaks

This applies the from D114259 to the SBStructuredData class.

Added: 


Modified: 
lldb/bindings/python/python-swigsafecast.swig
lldb/bindings/python/python-wrapper.swig

Removed: 




diff  --git a/lldb/bindings/python/python-swigsafecast.swig 
b/lldb/bindings/python/python-swigsafecast.swig
index fdd3b4e62c102..87abe0b3f1872 100644
--- a/lldb/bindings/python/python-swigsafecast.swig
+++ b/lldb/bindings/python/python-swigsafecast.swig
@@ -41,11 +41,6 @@ PyObject *SBTypeToSWIGWrapper(lldb::SBTypeSummaryOptions 
&summary_options_sb) {
 SWIGTYPE_p_lldb__SBTypeSummaryOptions, 0);
 }
 
-PyObject *SBTypeToSWIGWrapper(lldb::SBStructuredData &structured_data_sb) {
-  return SWIG_NewPointerObj(&structured_data_sb,
-SWIGTYPE_p_lldb__SBStructuredData, 0);
-}
-
 PyObject *SBTypeToSWIGWrapper(lldb::SBSymbolContext &sym_ctx_sb) {
   return SWIG_NewPointerObj(&sym_ctx_sb, SWIGTYPE_p_lldb__SBSymbolContext, 0);
 }
@@ -86,5 +81,13 @@ PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) 
{
   SWIGTYPE_p_lldb__SBBreakpoint);
 }
 
+PythonObject ToSWIGWrapper(std::unique_ptr data_sb) {
+  return ToSWIGHelper(data_sb.release(), SWIGTYPE_p_lldb__SBStructuredData);
+}
+
+PythonObject ToSWIGWrapper(const StructuredDataImpl &data_impl) {
+  return ToSWIGWrapper(std::make_unique(data_impl));
+}
+
 } // namespace python
 } // namespace lldb_private

diff  --git a/lldb/bindings/python/python-wrapper.swig 
b/lldb/bindings/python/python-wrapper.swig
index da943f73c4351..f1cf8c8e09d7d 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -52,14 +52,9 @@ lldb_private::LLDBSwigPythonBreakpointCallbackFunction
 
 auto result = [&] () -> Expected {
 // If the called function doesn't take extra_args, drop them here:
-if (max_positional_args < 4) {
+if (max_positional_args < 4)
 return pfunc.Call(frame_arg, bp_loc_arg, dict);
-} else {
-// FIXME: SBStructuredData leaked here
-lldb::SBStructuredData *args_value = new 
lldb::SBStructuredData(args_impl);
-PythonObject args_arg(PyRefType::Owned, 
SBTypeToSWIGWrapper(*args_value));
-return pfunc.Call(frame_arg, bp_loc_arg, args_arg, dict);
-}
+return pfunc.Call(frame_arg, bp_loc_arg, ToSWIGWrapper(args_impl), 
dict);
 } ();
 
 if (!result)
@@ -289,11 +284,7 @@ lldb_private::LLDBSwigPythonCreateScriptedProcess
 
 PythonObject result = {};
 if (arg_info.get().max_positional_args == 2) {
-// FIXME: SBStructuredData leaked here
-PythonObject args_arg(
-PyRefType::Owned,
-SBTypeToSWIGWrapper(*new lldb::SBStructuredData(args_impl)));
-result = pfunc(target_arg, args_arg);
+result = pfunc(target_arg, ToSWIGWrapper(args_impl));
 } else {
 error_string.assign("wrong number of arguments in __init__, should be 
2 (not including self)");
 Py_RETURN_NONE;
@@ -343,11 +334,7 @@ lldb_private::LLDBSwigPythonCreateScriptedThread
 
 PythonObject result = {};
 if (arg_info.get().max_positional_args == 2) {
-// FIXME: SBStructuredData leaked here
-PythonObject args_arg(
-PyRefType::Owned,
-SBTypeToSWIGWrapper(*new lldb::SBStructuredData(args_impl)));
-result = pfunc(ToSWIGWrapper(process_sp), args_arg);
+result = pfunc(ToSWIGWrapper(process_sp), ToSWIGWrapper(args_impl));
 } else {
 error_string.assign("wrong number of arguments in __init__, should be 
2 (not including self)");
 Py_RETURN_NONE;
@@ -399,8 +386,7 @@ lldb_private::LLDBSwigPythonCreateScriptedThreadPlan
 }
 
 PythonObject result = {};
-// FIXME: SBStructuredData leaked here
-auto *args_sb = new lldb::SBStructuredData(args_impl);
+auto args_sb = std::make_unique(args_impl);
 if (arg_info.get().max_positional_args == 2) {
 if (args_sb->IsValid()) {
error_string.assign("args passed, but __init__ does not take an 
args dictionary");
@@ -408,8 +394,7 @@ lldb_private::LLDBSwigPythonCreateScriptedThreadPlan
 }
 result = pfunc(tp_arg, dict);
 } else if (arg_info.get().max_positional_args >= 3) {
-PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(*args_sb));
-result = pfunc(tp_arg, args_arg, dict);
+result = pfunc(tp_arg, ToSWIGWrapper(std::move(args_sb)), dict);
 } else {
 error_string.assign("wrong number o

[Lldb-commits] [PATCH] D115736: [lldb] (Semi-automatically) format .swig files

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, mib.
labath requested review of this revision.
Herald added a project: LLDB.

I've found my recent ventures into the swig land painful because
of the strange way they are formatted. This patch attempts to alleviate
future headaches by formatting these files into something resembling the
normal llvm style.

Unfortunately, completely formatting these files automatically does not
work because clang format gets confused by swigs % syntax, so I have
employed a hybrid approach where I formatted blocks of c++ code with
clang-format and then manually massaged the code until it looked
reasonable (and compiled).

I don't expect these files to remain perfectly formatted (although, if
one's editor is configured to configure the current line/block on
request, one can get pretty good results by using it judiciously), but
at least it will prevent the (mangled form of the) old lldb style being
proliferated endlessly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115736

Files:
  lldb/bindings/lua/lua-swigsafecast.swig
  lldb/bindings/lua/lua-typemaps.swig
  lldb/bindings/lua/lua-wrapper.swig
  lldb/bindings/python/python-typemaps.swig
  lldb/bindings/python/python-wrapper.swig

Index: lldb/bindings/python/python-wrapper.swig
===
--- lldb/bindings/python/python-wrapper.swig
+++ lldb/bindings/python/python-wrapper.swig
@@ -1,67 +1,58 @@
 %header %{
 
-class PyErr_Cleaner
-{
+class PyErr_Cleaner {
 public:
-PyErr_Cleaner(bool print=false) :
-m_print(print)
-{
-}
+  PyErr_Cleaner(bool print = false) : m_print(print) {}
 
-~PyErr_Cleaner()
-{
-if (PyErr_Occurred())
-{
-if(m_print && !PyErr_ExceptionMatches(PyExc_SystemExit))
-PyErr_Print();
-PyErr_Clear();
-}
+  ~PyErr_Cleaner() {
+if (PyErr_Occurred()) {
+  if (m_print && !PyErr_ExceptionMatches(PyExc_SystemExit))
+PyErr_Print();
+  PyErr_Clear();
 }
+  }
 
 private:
-bool m_print;
+  bool m_print;
 };
 
-llvm::Expected
-lldb_private::LLDBSwigPythonBreakpointCallbackFunction
-(
-const char *python_function_name,
-const char *session_dictionary_name,
-const lldb::StackFrameSP& frame_sp,
-const lldb::BreakpointLocationSP& bp_loc_sp,
-const lldb_private::StructuredDataImpl &args_impl
-)
-{
-using namespace llvm;
-
-lldb::SBFrame sb_frame (frame_sp);
-lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
-
-PyErr_Cleaner py_err_cleaner(true);
-auto dict = PythonModule::MainModule().ResolveName(session_dictionary_name);
-auto pfunc = PythonObject::ResolveNameWithDictionary(python_function_name, dict);
-
-unsigned max_positional_args;
-if (auto arg_info = pfunc.GetArgInfo())
-max_positional_args = arg_info.get().max_positional_args;
-else
-return arg_info.takeError();
-
-PythonObject frame_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_frame));
-PythonObject bp_loc_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_bp_loc));
-
-auto result = [&] () -> Expected {
-// If the called function doesn't take extra_args, drop them here:
-if (max_positional_args < 4)
-return pfunc.Call(frame_arg, bp_loc_arg, dict);
-return pfunc.Call(frame_arg, bp_loc_arg, ToSWIGWrapper(args_impl), dict);
-} ();
-
-if (!result)
-return result.takeError();
-
-// Only False counts as false!
-return result.get().get() != Py_False;
+llvm::Expected lldb_private::LLDBSwigPythonBreakpointCallbackFunction(
+const char *python_function_name, const char *session_dictionary_name,
+const lldb::StackFrameSP &frame_sp,
+const lldb::BreakpointLocationSP &bp_loc_sp,
+const lldb_private::StructuredDataImpl &args_impl) {
+  using namespace llvm;
+
+  lldb::SBFrame sb_frame(frame_sp);
+  lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
+
+  PyErr_Cleaner py_err_cleaner(true);
+  auto dict = PythonModule::MainModule().ResolveName(
+  session_dictionary_name);
+  auto pfunc = PythonObject::ResolveNameWithDictionary(
+  python_function_name, dict);
+
+  unsigned max_positional_args;
+  if (auto arg_info = pfunc.GetArgInfo())
+max_positional_args = arg_info.get().max_positional_args;
+  else
+return arg_info.takeError();
+
+  PythonObject frame_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_frame));
+  PythonObject bp_loc_arg(PyRefType::Owned, SBTypeToSWIGWrapper(sb_bp_loc));
+
+  auto result = [&]() -> Expected {
+// If the called function doesn't take extra_args, drop them here:
+if (max_positional_args < 4)
+  return pfunc.Call(frame_arg, bp_loc_arg, dict);
+return pfunc.Call(frame_arg, bp_loc_arg, ToSWIGWrapper(args_impl), dict);
+  }();
+
+  if (!result)
+return result.takeError();
+
+  // Only False counts as false!
+  return result.get().get() != Py_False;
 }
 
 // resolve a dotted

[Lldb-commits] [lldb] aedb328 - [lldb] Introduce a FreeBSDKernel plugin for vmcores

2021-12-14 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-12-14T18:03:38+01:00
New Revision: aedb328a4dc9cb48ee3cf3198281649ea2c4f532

URL: 
https://github.com/llvm/llvm-project/commit/aedb328a4dc9cb48ee3cf3198281649ea2c4f532
DIFF: 
https://github.com/llvm/llvm-project/commit/aedb328a4dc9cb48ee3cf3198281649ea2c4f532.diff

LOG: [lldb] Introduce a FreeBSDKernel plugin for vmcores

Introduce a FreeBSDKernel plugin that provides the ability to read
FreeBSD kernel core dumps.  The plugin utilizes libfbsdvmcore to provide
support for both "full memory dump" and minidump formats across variety
of architectures supported by FreeBSD.  It provides the ability to read
kernel memory, as well as the crashed thread status with registers
on arm64, i386 and x86_64.

Differential Revision: https://reviews.llvm.org/D114911

Added: 
lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.h
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.h

lldb/test/API/functionalities/postmortem/FreeBSDKernel/TestFreeBSDKernelVMCore.py
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-amd64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-arm64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-i386.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/README.rst
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/copy-sparse.py

lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-full.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-arm64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-i386-minidump.bz2

Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Plugins/Process/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index b62cd7d24438f..5ddac2716ee5c 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -58,6 +58,7 @@ add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA 
compression support in LLD
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCORE_FOUND)
 
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 924e1fed4f38c..605ba251e73f2 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1570,7 +1570,7 @@ def findBuiltClang(self):
 return os.environ["CC"]
 
 
-def yaml2obj(self, yaml_path, obj_path):
+def yaml2obj(self, yaml_path, obj_path, max_size=None):
 """
 Create an object file at the given path from a yaml file.
 
@@ -1580,6 +1580,8 @@ def yaml2obj(self, yaml_path, obj_path):
 if not yaml2obj_bin:
 self.assertTrue(False, "No valid yaml2obj executable specified")
 command = [yaml2obj_bin, "-o=%s" % obj_path, yaml_path]
+if max_size is not None:
+command += ["--max-size=%d" % max_size]
 self.runBuildCommand(command)
 
 def getBuildFlags(

diff  --git a/lldb/source/Plugins/Process/CMakeLists.txt 
b/lldb/source/Plugins/Process/CMakeLists.txt
index bea5bac9eb217..a51d0f7afd175 100644
--- a/lldb/source/Plugins/Process/CMakeLists.txt
+++ b/lldb/source/Plugins

[Lldb-commits] [PATCH] D114911: [lldb] Introduce a FreeBSDKernel plugin for vmcores

2021-12-14 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaedb328a4dc9: [lldb] Introduce a FreeBSDKernel plugin for 
vmcores (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114911/new/

https://reviews.llvm.org/D114911

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Plugins/Process/CMakeLists.txt
  lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt
  lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h
  
lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.h
  
lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.h
  
lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.cpp
  
lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.h
  lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.h
  
lldb/test/API/functionalities/postmortem/FreeBSDKernel/TestFreeBSDKernelVMCore.py
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-amd64.yaml
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-arm64.yaml
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-i386.yaml
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/README.rst
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/copy-sparse.py
  
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
  lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-full.bz2
  
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-minidump.bz2
  
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-arm64-minidump.bz2
  
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-i386-minidump.bz2

Index: lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
===
--- /dev/null
+++ lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
@@ -0,0 +1,5 @@
+thread list
+register read pc
+bt
+p *(int*)&hz
+memory read &hz
Index: lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
===
--- /dev/null
+++ lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
@@ -0,0 +1,166 @@
+diff --git a/lib/fvc.c b/lib/fvc.c
+index e6b96c1..4033f78 100644
+--- a/lib/fvc.c
 b/lib/fvc.c
+@@ -297,6 +297,7 @@ fvc_read(fvc_t *kd, fvc_addr_t kva, void *buf, size_t len)
+ 			_fvc_syserr(kd, kd->program, "fvc_read");
+ 			break;
+ 		}
++		printf("%% RD: %zu %d\n", pa, cc);
+ 		/*
+ 		 * If ka_kvatop returns a bogus value or our core file is
+ 		 * truncated, we might wind up seeking beyond the end of the
+@@ -331,3 +332,8 @@ fvc_kerndisp(fvc_t *kd)
+ 
+ 	return (kd->arch->ka_kerndisp(kd));
+ }
++
++ssize_t xpread(int fd, void *buf, size_t count, off_t offset) {
++	printf("%% RD: %zu %zu\n", offset, count);
++	return pread(fd, buf, count, offset);
++}
+diff --git a/lib/fvc.h b/lib/fvc.h
+index 8680079..ff1e0f0 100644
+--- a/lib/fvc.h
 b/lib/fvc.h
+@@ -54,6 +54,8 @@ typedef unsigned char fvc_vm_prot_t;
+ #define	FVC_VM_PROT_WRITE		((fvc_vm_prot_t) 0x02)
+ #define	FVC_VM_PROT_EXECUTE		((fvc_vm_prot_t) 0x04)
+ 
++ssize_t xpread(int fd, void *buf, size_t count, off_t offset);
++
+ struct fvc_page {
+ 	unsigned int	kp_version;
+ 	fvc_addr_t	kp_paddr;
+diff --git a/lib/fvc_amd64.c b/lib/fvc_amd64.c
+index 4d27998..69f1807 100644
+--- a/lib/fvc_amd64.c
 b/lib/fvc_amd64.c
+@@ -205,7 +205,7 @@ _amd64_vatop(fvc_t *kd, fvc_addr_t va, off_t *pa)
+ 		_fvc_err(kd, kd->program, "_amd64_vatop: pdpe_pa not found");
+ 		goto invalid;
+ 	}
+-	if (pread(kd->pmfd, &pdpe, sizeof(pdpe), ofs) != sizeof(pdpe)) {
++	if (xpread(kd->pmfd, &pdpe, sizeof(pdpe), ofs) != sizeof(pdpe)) {
+ 		_fvc_syserr(kd, kd->program, "_amd64_vatop: read pdpe");
+ 		goto invalid;
+ 	}
+@@ -237,7 +237,7 @@ _amd64_vatop(fvc_t *kd, fvc_addr_t va, off_t *pa)
+ 		_fvc_syserr(kd, kd->program, "_amd64_vatop: pde_pa not found");
+ 		goto invalid;
+ 	}
+-	if (pread(kd->pmfd, &pde, sizeof(pde), ofs) != sizeof(pde)) {
++	if (xpread(kd->pmfd, &pde, sizeof(pde), ofs) != sizeof(pde)) {
+ 		_fvc_syserr(kd, kd->program, "_amd64_vatop: read pde");
+ 		goto invalid;
+ 	}
+@@ -269,7 +269,7 @@ _amd64_vatop(fvc_t *kd, fvc_addr_t va, off_t *pa)
+ 		_fvc_err(kd, kd->program, "_amd64_vatop: pte_pa not found");

[Lldb-commits] [lldb] 76c876e - Revert "[lldb] Introduce a FreeBSDKernel plugin for vmcores"

2021-12-14 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-12-14T18:17:54+01:00
New Revision: 76c876e7e6ef1271846a92cbea59c62b8f12ed47

URL: 
https://github.com/llvm/llvm-project/commit/76c876e7e6ef1271846a92cbea59c62b8f12ed47
DIFF: 
https://github.com/llvm/llvm-project/commit/76c876e7e6ef1271846a92cbea59c62b8f12ed47.diff

LOG: Revert "[lldb] Introduce a FreeBSDKernel plugin for vmcores"

This reverts commit aedb328a4dc9cb48ee3cf3198281649ea2c4f532.
I have failed to make the new tests conditional to the presence
of libfbsdvmcore.

Added: 


Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Plugins/Process/CMakeLists.txt

Removed: 
lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.h
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.h

lldb/test/API/functionalities/postmortem/FreeBSDKernel/TestFreeBSDKernelVMCore.py
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-amd64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-arm64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-i386.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/README.rst
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/copy-sparse.py

lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-full.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-arm64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-i386-minidump.bz2



diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 5ddac2716ee5c..b62cd7d24438f 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -58,7 +58,6 @@ add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA 
compression support in LLD
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
-add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCORE_FOUND)
 
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 605ba251e73f2..924e1fed4f38c 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1570,7 +1570,7 @@ def findBuiltClang(self):
 return os.environ["CC"]
 
 
-def yaml2obj(self, yaml_path, obj_path, max_size=None):
+def yaml2obj(self, yaml_path, obj_path):
 """
 Create an object file at the given path from a yaml file.
 
@@ -1580,8 +1580,6 @@ def yaml2obj(self, yaml_path, obj_path, max_size=None):
 if not yaml2obj_bin:
 self.assertTrue(False, "No valid yaml2obj executable specified")
 command = [yaml2obj_bin, "-o=%s" % obj_path, yaml_path]
-if max_size is not None:
-command += ["--max-size=%d" % max_size]
 self.runBuildCommand(command)
 
 def getBuildFlags(

diff  --git a/lldb/source/Plugins/Process/CMakeLists.txt 
b/lldb/source/Plugins/Process/CMakeLists.txt
index a51d0f7afd175..bea5bac9eb217 100644
--- a/lldb/source/Plugins/Process/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/CMakeLists.txt
@@ -18,4 +18,3 @@ add_subdirectory(Utility)
 add_subdirectory(elf-core)
 add_subdirectory(mach-core)
 add_subdirectory(minidump)
-add_subdirectory(FreeBSDKernel)

diff  --git a/lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt 
b/lldb/s

[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added a comment.

In D115662#3192064 , @labath wrote:

> I don't have any issues with this per se, but you may want to sync up with 
> @zequanwu, as his D115308  tries to delete 
> the second instance.

Maybe he can reach out here, but how is this related to D115308 
 ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115662/new/

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D115662: [lldb][DWARF] Remove duplicate DIE type assignment

2021-12-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D115662#3192651 , @ljmf00 wrote:

> In D115662#3192064 , @labath wrote:
>
>> I don't have any issues with this per se, but you may want to sync up with 
>> @zequanwu, as his D115308  tries to delete 
>> the second instance.
>
> Maybe he can reach out here, but how is this related to D115308 
>  ?

You're right -- it isn't as related as I originally thought -- you're 
deduplicating the dietotype map, and he's doing it for the type list.

But it still is related at least on a conceptual level, as both patches deal 
with recording information about the type, and would be good if those things 
could happen in a central place (and you seem to have picked different 
centralization points). Maybe there is a reason it has to be that way (I 
honestly don't know) but it at least seems like to be aware of each other's 
efforts.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115662/new/

https://reviews.llvm.org/D115662

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


[Lldb-commits] [PATCH] D115736: [lldb] (Semi-automatically) format .swig files

2021-12-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115736/new/

https://reviews.llvm.org/D115736

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


[Lldb-commits] [PATCH] D115736: [lldb] (Semi-automatically) format .swig files

2021-12-14 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib accepted this revision.
mib added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115736/new/

https://reviews.llvm.org/D115736

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


[Lldb-commits] [lldb] efefc4e - [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-12-14 Thread Luís Ferreira via lldb-commits

Author: Luís Ferreira
Date: 2021-12-14T19:31:18Z
New Revision: efefc4ee3b25ca180e3be84491f19218d995c788

URL: 
https://github.com/llvm/llvm-project/commit/efefc4ee3b25ca180e3be84491f19218d995c788
DIFF: 
https://github.com/llvm/llvm-project/commit/efefc4ee3b25ca180e3be84491f19218d995c788.diff

LOG: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

Reviewed By: teemperor, JDevlieghere, dblaikie

Differential Revision: https://reviews.llvm.org/D113604

Added: 


Modified: 
lldb/include/lldb/Symbol/Type.h
lldb/source/Symbol/Type.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 9e671a565dd14..6f89814c86a75 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,7 +201,7 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(llvm::StringRef name,
   llvm::StringRef &scope,
   llvm::StringRef &basename,
   lldb::TypeClass &type_class);
@@ -473,8 +477,8 @@ class TypeEnumMemberImpl {
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
- ConstString name, const llvm::APSInt &value);
+  TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp, ConstString name,
+ const llvm::APSInt &value);
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs) = default;
 

diff  --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 5b4169d256d29..d6c82ed1dd80b 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@ ConstString Type::GetQualifiedName() {
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef &scope,
llvm::StringRef &basename,
TypeClass &type_class) {



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://li

[Lldb-commits] [PATCH] D113604: [lldb][NFC] Format lldb/include/lldb/Symbol/Type.h

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGefefc4ee3b25: [lldb][NFC] Format 
lldb/include/lldb/Symbol/Type.h (authored by ljmf00).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113604/new/

https://reviews.llvm.org/D113604

Files:
  lldb/include/lldb/Symbol/Type.h
  lldb/source/Symbol/Type.cpp


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef &scope,
llvm::StringRef &basename,
TypeClass &type_class) {
Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -67,23 +67,27 @@
 public:
   enum EncodingDataType {
 eEncodingInvalid,
-eEncodingIsUID,  ///< This type is the type whose UID is m_encoding_uid
-eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
- /// with the const qualifier added
-eEncodingIsRestrictUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the restrict qualifier 
added
-eEncodingIsVolatileUID, ///< This type is the type whose UID is
-/// m_encoding_uid with the volatile qualifier 
added
-eEncodingIsTypedefUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsPointerUID,  ///< This type is pointer to a type whose UID is
-/// m_encoding_uid
-eEncodingIsLValueReferenceUID, ///< This type is L value reference to a 
type
-   /// whose UID is m_encoding_uid
-eEncodingIsRValueReferenceUID, ///< This type is R value reference to a 
type
-   /// whose UID is m_encoding_uid,
-eEncodingIsAtomicUID,  ///< This type is the type whose UID is
-   /// m_encoding_uid as an atomic type.
+/// This type is the type whose UID is m_encoding_uid.
+eEncodingIsUID,
+/// This type is the type whose UID is m_encoding_uid with the const
+/// qualifier added.
+eEncodingIsConstUID,
+/// This type is the type whose UID is m_encoding_uid with the restrict
+/// qualifier added.
+eEncodingIsRestrictUID,
+/// This type is the type whose UID is m_encoding_uid with the volatile
+/// qualifier added.
+eEncodingIsVolatileUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsTypedefUID,
+/// This type is pointer to a type whose UID is m_encoding_uid.
+eEncodingIsPointerUID,
+/// This type is L value reference to a type whose UID is m_encoding_uid.
+eEncodingIsLValueReferenceUID,
+/// This type is R value reference to a type whose UID is m_encoding_uid.
+eEncodingIsRValueReferenceUID,
+/// This type is the type whose UID is m_encoding_uid as an atomic type.
+eEncodingIsAtomicUID,
 eEncodingIsSyntheticUID
   };
 
@@ -197,7 +201,7 @@
 
   // From a fully qualified typename, split the type into the type basename and
   // the remaining type scope (namespaces/classes).
-  static bool GetTypeScopeAndBasename(const llvm::StringRef& name,
+  static bool GetTypeScopeAndBasename(llvm::StringRef name,
   llvm::StringRef &scope,
   llvm::StringRef &basename,
   lldb::TypeClass &type_class);
@@ -473,8 +477,8 @@
 public:
   TypeEnumMemberImpl() : m_integer_type_sp(), m_name(""), m_value() {}
 
-  TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
- ConstString name, const llvm::APSInt &value);
+  TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp, ConstString name,
+ const llvm::APSInt &value);
 
   TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs) = default;
 


Index: lldb/source/Symbol/Type.cpp
===
--- lldb/source/Symbol/Type.cpp
+++ lldb/source/Symbol/Type.cpp
@@ -662,7 +662,7 @@
   return GetForwardCompilerType().GetTypeName();
 }
 
-bool Type::GetTypeScopeAndBasename(const llvm::StringRef& name,
+bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
llvm::StringRef &scope,
llvm::StringRef &basename,
TypeClass &type_class) {
Index: lldb/include/lldb/Symbol/Type.h
==

[Lldb-commits] [lldb] 100863c - [lldb] Check if language is supported before creating a REPL instance

2021-12-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-12-14T12:05:35-08:00
New Revision: 100863ccd8d41091f90749ba76d91f6dfafdde57

URL: 
https://github.com/llvm/llvm-project/commit/100863ccd8d41091f90749ba76d91f6dfafdde57
DIFF: 
https://github.com/llvm/llvm-project/commit/100863ccd8d41091f90749ba76d91f6dfafdde57.diff

LOG: [lldb] Check if language is supported before creating a REPL instance

Currently, we'll try to instantiate a ClangREPL for every known
language. The plugin manager already knows what languages it supports,
so rely on that to only instantiate a REPL when we know the requested
language is supported.

rdar://86439474

Differential revision: https://reviews.llvm.org/D115698

Added: 
lldb/test/Shell/REPL/Basic.test

Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/Core/PluginManager.cpp
lldb/source/Expression/REPL.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 7dc99bf3e7558..1ab9d26d3af4f 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -449,6 +449,8 @@ class PluginManager {
 
   static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
 
+  static LanguageSet GetREPLSupportedLanguagesAtIndex(uint32_t idx);
+
   static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
 
   // Some plug-ins might register a DebuggerInitializeCallback callback when

diff  --git a/lldb/source/Core/PluginManager.cpp 
b/lldb/source/Core/PluginManager.cpp
index 801591129244f..37050494aa2ea 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -1345,6 +1345,12 @@ REPLCreateInstance 
PluginManager::GetREPLCreateCallbackAtIndex(uint32_t idx) {
   return GetREPLInstances().GetCallbackAtIndex(idx);
 }
 
+LanguageSet PluginManager::GetREPLSupportedLanguagesAtIndex(uint32_t idx) {
+  const auto &instances = GetREPLInstances().GetInstances();
+  return idx < instances.size() ? instances[idx].supported_languages
+: LanguageSet();
+}
+
 LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
   const auto &instances = GetREPLInstances().GetInstances();
   LanguageSet all;

diff  --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 9cd6129eedd7a..be41c60ebb5ff 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -39,7 +39,11 @@ lldb::REPLSP REPL::Create(Status &err, lldb::LanguageType 
language,
   lldb::REPLSP ret;
 
   while (REPLCreateInstance create_instance =
- PluginManager::GetREPLCreateCallbackAtIndex(idx++)) {
+ PluginManager::GetREPLCreateCallbackAtIndex(idx)) {
+LanguageSet supported_languages =
+PluginManager::GetREPLSupportedLanguagesAtIndex(idx++);
+if (!supported_languages[language])
+  continue;
 ret = (*create_instance)(err, language, debugger, target, repl_options);
 if (ret) {
   break;

diff  --git a/lldb/test/Shell/REPL/Basic.test b/lldb/test/Shell/REPL/Basic.test
new file mode 100644
index 0..39791133d5f2c
--- /dev/null
+++ b/lldb/test/Shell/REPL/Basic.test
@@ -0,0 +1,10 @@
+// Basic sanity checking of the REPL.
+
+// RUN: %lldb --repl --repl-language c++ 2>&1 | FileCheck %s --check-prefix=CPP
+// CPP: error: must have a target to create a REPL
+
+// RUN: %lldb --repl --repl-language python 2>&1 | FileCheck %s 
--check-prefix=PYTHON
+// PYTHON: error: couldn't find a REPL for python
+
+// RUN: not %lldb --repl --repl-language bogus 2>&1 | FileCheck %s 
--check-prefix=BOGUS
+// BOGUS: error: Unrecognized language name: "bogus"



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


[Lldb-commits] [PATCH] D115698: [lldb] Check if language is supported before creating a REPL instance

2021-12-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG100863ccd8d4: [lldb] Check if language is supported before 
creating a REPL instance (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115698/new/

https://reviews.llvm.org/D115698

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/source/Core/PluginManager.cpp
  lldb/source/Expression/REPL.cpp
  lldb/test/Shell/REPL/Basic.test


Index: lldb/test/Shell/REPL/Basic.test
===
--- /dev/null
+++ lldb/test/Shell/REPL/Basic.test
@@ -0,0 +1,10 @@
+// Basic sanity checking of the REPL.
+
+// RUN: %lldb --repl --repl-language c++ 2>&1 | FileCheck %s --check-prefix=CPP
+// CPP: error: must have a target to create a REPL
+
+// RUN: %lldb --repl --repl-language python 2>&1 | FileCheck %s 
--check-prefix=PYTHON
+// PYTHON: error: couldn't find a REPL for python
+
+// RUN: not %lldb --repl --repl-language bogus 2>&1 | FileCheck %s 
--check-prefix=BOGUS
+// BOGUS: error: Unrecognized language name: "bogus"
Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -39,7 +39,11 @@
   lldb::REPLSP ret;
 
   while (REPLCreateInstance create_instance =
- PluginManager::GetREPLCreateCallbackAtIndex(idx++)) {
+ PluginManager::GetREPLCreateCallbackAtIndex(idx)) {
+LanguageSet supported_languages =
+PluginManager::GetREPLSupportedLanguagesAtIndex(idx++);
+if (!supported_languages[language])
+  continue;
 ret = (*create_instance)(err, language, debugger, target, repl_options);
 if (ret) {
   break;
Index: lldb/source/Core/PluginManager.cpp
===
--- lldb/source/Core/PluginManager.cpp
+++ lldb/source/Core/PluginManager.cpp
@@ -1345,6 +1345,12 @@
   return GetREPLInstances().GetCallbackAtIndex(idx);
 }
 
+LanguageSet PluginManager::GetREPLSupportedLanguagesAtIndex(uint32_t idx) {
+  const auto &instances = GetREPLInstances().GetInstances();
+  return idx < instances.size() ? instances[idx].supported_languages
+: LanguageSet();
+}
+
 LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
   const auto &instances = GetREPLInstances().GetInstances();
   LanguageSet all;
Index: lldb/include/lldb/Core/PluginManager.h
===
--- lldb/include/lldb/Core/PluginManager.h
+++ lldb/include/lldb/Core/PluginManager.h
@@ -449,6 +449,8 @@
 
   static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
 
+  static LanguageSet GetREPLSupportedLanguagesAtIndex(uint32_t idx);
+
   static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
 
   // Some plug-ins might register a DebuggerInitializeCallback callback when


Index: lldb/test/Shell/REPL/Basic.test
===
--- /dev/null
+++ lldb/test/Shell/REPL/Basic.test
@@ -0,0 +1,10 @@
+// Basic sanity checking of the REPL.
+
+// RUN: %lldb --repl --repl-language c++ 2>&1 | FileCheck %s --check-prefix=CPP
+// CPP: error: must have a target to create a REPL
+
+// RUN: %lldb --repl --repl-language python 2>&1 | FileCheck %s --check-prefix=PYTHON
+// PYTHON: error: couldn't find a REPL for python
+
+// RUN: not %lldb --repl --repl-language bogus 2>&1 | FileCheck %s --check-prefix=BOGUS
+// BOGUS: error: Unrecognized language name: "bogus"
Index: lldb/source/Expression/REPL.cpp
===
--- lldb/source/Expression/REPL.cpp
+++ lldb/source/Expression/REPL.cpp
@@ -39,7 +39,11 @@
   lldb::REPLSP ret;
 
   while (REPLCreateInstance create_instance =
- PluginManager::GetREPLCreateCallbackAtIndex(idx++)) {
+ PluginManager::GetREPLCreateCallbackAtIndex(idx)) {
+LanguageSet supported_languages =
+PluginManager::GetREPLSupportedLanguagesAtIndex(idx++);
+if (!supported_languages[language])
+  continue;
 ret = (*create_instance)(err, language, debugger, target, repl_options);
 if (ret) {
   break;
Index: lldb/source/Core/PluginManager.cpp
===
--- lldb/source/Core/PluginManager.cpp
+++ lldb/source/Core/PluginManager.cpp
@@ -1345,6 +1345,12 @@
   return GetREPLInstances().GetCallbackAtIndex(idx);
 }
 
+LanguageSet PluginManager::GetREPLSupportedLanguagesAtIndex(uint32_t idx) {
+  const auto &instances = GetREPLInstances().GetInstances();
+  return idx < instances.size() ? instances[idx].supported_languages
+: LanguageSet();
+}
+
 LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
   const auto &instances = GetREPLInstances().Ge

[Lldb-commits] [lldb] 1695dd1 - [lldb][NFC] Fix documentation for EncodingDataType

2021-12-14 Thread Luís Ferreira via lldb-commits

Author: Luís Ferreira
Date: 2021-12-14T20:13:30Z
New Revision: 1695dd17524264a199d3731afe8e786bd1ce58c8

URL: 
https://github.com/llvm/llvm-project/commit/1695dd17524264a199d3731afe8e786bd1ce58c8
DIFF: 
https://github.com/llvm/llvm-project/commit/1695dd17524264a199d3731afe8e786bd1ce58c8.diff

LOG: [lldb][NFC] Fix documentation for EncodingDataType

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D113605

Added: 


Modified: 
lldb/include/lldb/Symbol/Type.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 6f89814c86a75..7754e02990964 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@ class SymbolFileType : public 
std::enable_shared_from_this,
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding.
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@ class Type : public std::enable_shared_from_this, 
public UserID {
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 



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


[Lldb-commits] [PATCH] D113605: [lldb][NFC] Fix documentation for EncodingDataType

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1695dd175242: [lldb][NFC] Fix documentation for 
EncodingDataType (authored by ljmf00).

Changed prior to commit:
  https://reviews.llvm.org/D113605?vs=386362&id=394345#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113605/new/

https://reviews.llvm.org/D113605

Files:
  lldb/include/lldb/Symbol/Type.h


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding.
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 


Index: lldb/include/lldb/Symbol/Type.h
===
--- lldb/include/lldb/Symbol/Type.h
+++ lldb/include/lldb/Symbol/Type.h
@@ -66,6 +66,7 @@
 class Type : public std::enable_shared_from_this, public UserID {
 public:
   enum EncodingDataType {
+/// Invalid encoding.
 eEncodingInvalid,
 /// This type is the type whose UID is m_encoding_uid.
 eEncodingIsUID,
@@ -78,7 +79,7 @@
 /// This type is the type whose UID is m_encoding_uid with the volatile
 /// qualifier added.
 eEncodingIsVolatileUID,
-/// This type is pointer to a type whose UID is m_encoding_uid.
+/// This type is alias to a type whose UID is m_encoding_uid.
 eEncodingIsTypedefUID,
 /// This type is pointer to a type whose UID is m_encoding_uid.
 eEncodingIsPointerUID,
@@ -88,6 +89,7 @@
 eEncodingIsRValueReferenceUID,
 /// This type is the type whose UID is m_encoding_uid as an atomic type.
 eEncodingIsAtomicUID,
+/// This type is the synthetic type whose UID is m_encoding_uid.
 eEncodingIsSyntheticUID
   };
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113605: [lldb][NFC] Fix documentation for EncodingDataType

2021-12-14 Thread Luís Ferreira via Phabricator via lldb-commits
ljmf00 added inline comments.



Comment at: lldb/include/lldb/Symbol/Type.h:69
   enum EncodingDataType {
+/// Invalid encoding
 eEncodingInvalid,

teemperor wrote:
> nit: LLVM comments end in a period.
Fixed on push.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113605/new/

https://reviews.llvm.org/D113605

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


[Lldb-commits] [PATCH] D115482: [lldb] Update the PDB tests to pass with the VS2019 toolset

2021-12-14 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf4abf28c0a0b: [lldb] Update the PDB tests to pass with the 
VS2019 toolset (authored by stella.stamenova).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115482/new/

https://reviews.llvm.org/D115482

Files:
  lldb/test/Shell/SymbolFile/PDB/ast-restore.test
  lldb/test/Shell/SymbolFile/PDB/class-layout.test
  lldb/test/Shell/SymbolFile/PDB/enums-layout.test
  lldb/test/Shell/SymbolFile/PDB/typedefs.test
  lldb/test/Shell/SymbolFile/PDB/variables.test

Index: lldb/test/Shell/SymbolFile/PDB/variables.test
===
--- lldb/test/Shell/SymbolFile/PDB/variables.test
+++ lldb/test/Shell/SymbolFile/PDB/variables.test
@@ -51,7 +51,7 @@
 FUNC-MAIN-NEXT: Variable{{.*}}, name = "a"
 FUNC-MAIN-SAME: scope = local
 
-FUNC-CONSTRUCTOR:  Function{{.*}}, mangled = ??0Class@@QEAA@H@Z
+FUNC-CONSTRUCTOR:  Function{{.*}}, {{(de)?}}mangled = {{.*}}{{(Class::)?}}Class{{.*}}
 FUNC-CONSTRUCTOR-NEXT:   Block
 FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "this"
 FUNC-CONSTRUCTOR-SAME: scope = parameter
@@ -59,7 +59,7 @@
 FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "a"
 FUNC-CONSTRUCTOR-SAME: scope = parameter
 
-FUNC-MEMBER:  Function{{.*}}, mangled = ?Func@Class@@QEAAXXZ
+FUNC-MEMBER:  Function{{.*}}, {{(de)?}}mangled = {{.*}}{{(Class::)?}}Func{{.*}}
 FUNC-MEMBER-NEXT:   Block
 FUNC-MEMBER-NEXT: Variable{{.*}}, name = "this"
 FUNC-MEMBER-SAME: scope = parameter
Index: lldb/test/Shell/SymbolFile/PDB/typedefs.test
===
--- lldb/test/Shell/SymbolFile/PDB/typedefs.test
+++ lldb/test/Shell/SymbolFile/PDB/typedefs.test
@@ -17,7 +17,6 @@
 CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t
 CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long
 CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long[10]
-CHECK-DAG: Type{{.*}} , name = "ULongArrayTypedef", compiler_type = {{.*}} typedef ULongArrayTypedef
 
 ; Note: compiler_type of `long double` is represented by the one for `double`
 CHECK-DAG: Type{{.*}} , name = "double", size = 8, compiler_type = {{.*}} double
Index: lldb/test/Shell/SymbolFile/PDB/enums-layout.test
===
--- lldb/test/Shell/SymbolFile/PDB/enums-layout.test
+++ lldb/test/Shell/SymbolFile/PDB/enums-layout.test
@@ -10,35 +10,35 @@
 ; FIXME: PDB does not have information about scoped enumeration (Enum class) so the  
 ; compiler type used is the same as the one for unscoped enumeration.
 
-ENUM:  Type{{.*}} , name = "Enum", size = 4, decl = simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum {
+ENUM:  Type{{.*}} , name = "Enum", size = 4, decl = {{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:19, compiler_type = {{.*}} enum Enum {
 ENUM_NEXT:RED,
 ENUM_NEXT:GREEN,
 ENUM_NEXT:BLUE
 ENUM_NEXT:}
 
-ENUM_CONST:  Type{{.*}} , name = "EnumConst", size = 4,  decl = simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst {
+ENUM_CONST:  Type{{.*}} , name = "EnumConst", size = 4,  decl = {{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:22, compiler_type = {{.*}} enum EnumConst {
 ENUM_CONST-NEXT:LOW,
 ENUM_CONST-NEXT:NORMAL,
 ENUM_CONST-NEXT:HIGH
 ENUM_CONST-NEXT:}
 
-ENUM_EMPTY:  Type{{.*}} , name = "EnumEmpty", size = 4,  decl = simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
+ENUM_EMPTY:  Type{{.*}} , name = "EnumEmpty", size = 4,  decl = {{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
 ENUM_EMPTY-NEXT:}
 
-ENUM_UCHAR:  Type{{.*}} , name = "EnumUChar", size = 1,  decl = simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar {
+ENUM_UCHAR:  Type{{.*}} , name = "EnumUChar", size = 1,  decl = {{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:28, compiler_type = {{.*}} enum EnumUChar {
 ENUM_UCHAR-NEXT:ON,
 ENUM_UCHAR-NEXT:OFF,
 ENUM_UCHAR-NEXT:AUTO
 ENUM_UCHAR-NEXT:}
 
 ; Note that `enum EnumClass` is tested instead of `enum class EnumClass`
-ENUM_CLASS:  Type{{.*}} , name = "EnumClass", size = 4,  decl = simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass {
+ENUM_CLASS:  Type{{.*}} , name = "EnumClass", size = 4,  decl = {{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:32, compiler_type = {{.*}} enum EnumClass {
 ENUM_CLASS-NEXT:YES,
 ENUM_CLASS-NEXT:NO,
 ENUM_CLASS-NEXT:DEFAULT
 ENUM_CLASS-NEXT:}
 
-ENUM_STRUCT:  Type{{.*}} , name = "EnumStruct", size = 4,  decl = simpletypestest.cpp:35, compiler_type = {{.*}} enum EnumStruct {
+ENUM_STRUCT:  Type{{.*}} , name = "EnumStruct", size = 4,  decl = {{[Ss

[Lldb-commits] [lldb] f4abf28 - [lldb] Update the PDB tests to pass with the VS2019 toolset

2021-12-14 Thread Stella Stamenova via lldb-commits

Author: Stella Stamenova
Date: 2021-12-14T13:06:07-08:00
New Revision: f4abf28c0a0ba2226379a1b1926a7c36d75265e9

URL: 
https://github.com/llvm/llvm-project/commit/f4abf28c0a0ba2226379a1b1926a7c36d75265e9
DIFF: 
https://github.com/llvm/llvm-project/commit/f4abf28c0a0ba2226379a1b1926a7c36d75265e9.diff

LOG: [lldb] Update the PDB tests to pass with the VS2019 toolset

The pdb lldb tests do not work correctly with both the VS2019 and VS2017 
toolsets at the moment. This change updates several of the tests to work with 
both toolsets. Unfortunately, this makes the tests suboptimal for both 
toolsets, but we can update them to be better for VS2019 once we officially 
drop VS2017. This change is meant to bridge the gap until the update happens, 
so that the buildbots can work with either toolset.

Differential Revision: https://reviews.llvm.org/D115482

Added: 


Modified: 
lldb/test/Shell/SymbolFile/PDB/ast-restore.test
lldb/test/Shell/SymbolFile/PDB/class-layout.test
lldb/test/Shell/SymbolFile/PDB/enums-layout.test
lldb/test/Shell/SymbolFile/PDB/typedefs.test
lldb/test/Shell/SymbolFile/PDB/variables.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/PDB/ast-restore.test 
b/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
index 2473bb1d66f57..2763f46070244 100644
--- a/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
+++ b/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
@@ -56,7 +56,7 @@ CLASS-DAG: static const N0::N1::(anonymous 
namespace)::Enum ClassSta
 CLASS-DAG: static const N0::N1::(anonymous namespace)::ScopedEnum 
ClassStaticConstScopedEnum = 4;
 CLASS-DAG: N0::N1::Class::Inner m_inner;
 CLASS-DAG: {{(inline )?}}Class(N0::N1::(anonymous 
namespace)::Enum);
-CLASS-DAG: static {{(inline )?}}int StaticFunc(const N0::N1::Class 
&);
+CLASS-DAG: {{(static )?}}{{(inline )?}}int StaticFunc(const 
N0::N1::Class &);
 CLASS-DAG: {{(inline )?}}int PrivateFunc(const 
N0::N1::Class::Inner &);
 CLASS: };
 CLASS: }

diff  --git a/lldb/test/Shell/SymbolFile/PDB/class-layout.test 
b/lldb/test/Shell/SymbolFile/PDB/class-layout.test
index fcd6b610826dc..c99a180f4f632 100644
--- a/lldb/test/Shell/SymbolFile/PDB/class-layout.test
+++ b/lldb/test/Shell/SymbolFile/PDB/class-layout.test
@@ -85,7 +85,7 @@ CLASS:int m_protected;
 CLASS:Class();
 CLASS:Class(int);
 CLASS:~Class();
-CLASS:static int {{.*}}StaticMemberFunc(int, ...);
+CLASS:{{(static )?}}int {{.*}}StaticMemberFunc(int, ...);
 CLASS:int Get();
 CLASS:int f(MemberTest::Friend);
 CLASS:bool operator==(const MemberTest::Class &)

diff  --git a/lldb/test/Shell/SymbolFile/PDB/enums-layout.test 
b/lldb/test/Shell/SymbolFile/PDB/enums-layout.test
index 79efb259663d1..2bfb9eb0b7f28 100644
--- a/lldb/test/Shell/SymbolFile/PDB/enums-layout.test
+++ b/lldb/test/Shell/SymbolFile/PDB/enums-layout.test
@@ -10,35 +10,35 @@ RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | 
FileCheck --check-pref
 ; FIXME: PDB does not have information about scoped enumeration (Enum class) 
so the  
 ; compiler type used is the same as the one for unscoped enumeration.
 
-ENUM:  Type{{.*}} , name = "Enum", size = 4, decl = 
simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum {
+ENUM:  Type{{.*}} , name = "Enum", size = 4, decl = 
{{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:19, compiler_type = {{.*}} enum Enum {
 ENUM_NEXT:RED,
 ENUM_NEXT:GREEN,
 ENUM_NEXT:BLUE
 ENUM_NEXT:}
 
-ENUM_CONST:  Type{{.*}} , name = "EnumConst", size = 4,  decl = 
simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst {
+ENUM_CONST:  Type{{.*}} , name = "EnumConst", size = 4,  decl = 
{{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:22, compiler_type = {{.*}} enum 
EnumConst {
 ENUM_CONST-NEXT:LOW,
 ENUM_CONST-NEXT:NORMAL,
 ENUM_CONST-NEXT:HIGH
 ENUM_CONST-NEXT:}
 
-ENUM_EMPTY:  Type{{.*}} , name = "EnumEmpty", size = 4,  decl = 
simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty {
+ENUM_EMPTY:  Type{{.*}} , name = "EnumEmpty", size = 4,  decl = 
{{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:25, compiler_type = {{.*}} enum 
EnumEmpty {
 ENUM_EMPTY-NEXT:}
 
-ENUM_UCHAR:  Type{{.*}} , name = "EnumUChar", size = 1,  decl = 
simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar {
+ENUM_UCHAR:  Type{{.*}} , name = "EnumUChar", size = 1,  decl = 
{{[Ss]}}imple{{[Tt]}}ypes{{[Tt]}}est.cpp:28, compiler_type = {{.*}} enum 
EnumUChar {
 ENUM_UCHAR-NEXT:ON,
 ENUM_UCHAR-NEXT:OFF,
 ENUM_UCHAR-NEXT:AUTO
 ENUM_UCHAR-NEXT:}
 
 ; Note that `enum EnumClass` is tested instead of `enum class EnumClass`
-ENUM_CLASS:  Type{{.*}} , name = "EnumClass", size = 4,  decl = 
simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass {
+ENUM_CLASS:  Type{{.*}} , name = "EnumClass", size = 4,  decl = 
{{[Ss]}}

[Lldb-commits] [lldb] 9c7fbc3 - [lldb] Introduce a FreeBSDKernel plugin for vmcores

2021-12-14 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-12-14T22:07:20+01:00
New Revision: 9c7fbc3f9b05b3249468ef6aeacaf71841b5cfe3

URL: 
https://github.com/llvm/llvm-project/commit/9c7fbc3f9b05b3249468ef6aeacaf71841b5cfe3
DIFF: 
https://github.com/llvm/llvm-project/commit/9c7fbc3f9b05b3249468ef6aeacaf71841b5cfe3.diff

LOG: [lldb] Introduce a FreeBSDKernel plugin for vmcores

Introduce a FreeBSDKernel plugin that provides the ability to read
FreeBSD kernel core dumps.  The plugin utilizes libfbsdvmcore to provide
support for both "full memory dump" and minidump formats across variety
of architectures supported by FreeBSD.  It provides the ability to read
kernel memory, as well as the crashed thread status with registers
on arm64, i386 and x86_64.

Differential Revision: https://reviews.llvm.org/D114911

Added: 
lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_arm64.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_i386.h

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.cpp

lldb/source/Plugins/Process/FreeBSDKernel/RegisterContextFreeBSDKernel_x86_64.h
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.h

lldb/test/API/functionalities/postmortem/FreeBSDKernel/TestFreeBSDKernelVMCore.py
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-amd64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-arm64.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/kernel-i386.yaml
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/README.rst
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/copy-sparse.py

lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/libfbsdvmcore-print-offsets.patch
lldb/test/API/functionalities/postmortem/FreeBSDKernel/tools/test.script
lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-full.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-amd64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-arm64-minidump.bz2

lldb/test/API/functionalities/postmortem/FreeBSDKernel/vmcore-i386-minidump.bz2

Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/include/lldb/Host/Config.h.cmake
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/API/SBDebugger.cpp
lldb/source/Plugins/Process/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index b62cd7d24438f..687c754326bd1 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -58,6 +58,7 @@ add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA 
compression support in LLD
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" 
LuaAndSwig LUAANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
+add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support 
in LLDB" FBSDVMCore FBSDVMCore_FOUND)
 
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)

diff  --git a/lldb/include/lldb/Host/Config.h.cmake 
b/lldb/include/lldb/Host/Config.h.cmake
index 777a6d1be5418..ffe919aa99561 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -45,6 +45,8 @@
 
 #cmakedefine01 LLDB_ENABLE_PYTHON
 
+#cmakedefine01 LLDB_ENABLE_FBSDVMCORE
+
 #cmakedefine01 LLDB_EMBED_PYTHON_HOME
 
 #cmakedefine LLDB_PYTHON_HOME R"(${LLDB_PYTHON_HOME})"

diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index b6ef3f08df22c..c44c007a20fc2 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -881,6 +881,9 @@ def skipIfXmlSupportMissing(func):
 def skipIfEditlineSupportMissing(func):
 return _get_bool_config_skip_if_decorator("editline")(func)
 
+def skipIfFBSDVMCoreSupportMissing(func):
+return _get_bool_config_skip_if_decorator("fbsdvmcore")(func)
+
 def skipIfLLVMTargetMissing(target):
 config

[Lldb-commits] [PATCH] D115324: Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

2021-12-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 394442.
clayborg marked an inline comment as done.
clayborg added a comment.

Changes:

- Updated Symtab class to not have to work around not having an object file and 
created a test with an object file
- Don't use hack to encode Symbol bitfield values.
- Remove file system IsDirectory check that wasn't needed
- Switch to use constexpr llvm::StringLiteral where requested
- Switch to use constexpr uint32_t for CURRENT_CACHE_VERSION
- Moved DataFileCache to Core since it relies on ModuleList's properties
- Fixed unsafe capture in lambda
- Switch log calls in DataFileCache.cpp to use LLDB_LOG_ERROR
- Updated test to create a module/object file from yaml to avoid having to hack 
Symtab to deal with NULL m_objfile


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115324/new/

https://reviews.llvm.org/D115324

Files:
  lldb/include/lldb/Core/DataFileCache.h
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Host/FileSystem.h
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/include/lldb/Utility/DataEncoder.h
  lldb/include/lldb/lldb-forward.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/DataFileCache.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/source/Utility/DataEncoder.cpp
  lldb/test/API/functionalities/module_cache/bsd/Makefile
  lldb/test/API/functionalities/module_cache/bsd/TestModuleCacheBSD.py
  lldb/test/API/functionalities/module_cache/bsd/a.c
  lldb/test/API/functionalities/module_cache/bsd/b.c
  lldb/test/API/functionalities/module_cache/bsd/c.c
  lldb/test/API/functionalities/module_cache/bsd/main.c
  lldb/test/API/functionalities/module_cache/simple_exe/Makefile
  lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
  lldb/test/API/functionalities/module_cache/simple_exe/main.c
  lldb/test/API/functionalities/module_cache/universal/Makefile
  
lldb/test/API/functionalities/module_cache/universal/TestModuleCacheUniversal.py
  lldb/test/API/functionalities/module_cache/universal/main.c
  lldb/unittests/Symbol/CMakeLists.txt
  lldb/unittests/Symbol/SymbolTest.cpp

Index: lldb/unittests/Symbol/SymbolTest.cpp
===
--- /dev/null
+++ lldb/unittests/Symbol/SymbolTest.cpp
@@ -0,0 +1,485 @@
+//===-- SymbolTest.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "TestingSupport/TestUtilities.h"
+
+#include "lldb/Core/DataFileCache.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/Symbol.h"
+#include "lldb/Symbol/Symtab.h"
+#include "lldb/Utility/DataEncoder.h"
+#include "lldb/Utility/DataExtractor.h"
+
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include 
+
+#include "gtest/gtest.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static void EncodeDecode(const Symbol &object, const SectionList *sect_list,
+ ByteOrder byte_order) {
+  const uint8_t addr_size = 8;
+  DataEncoder file(byte_order, addr_size);
+  DataEncoder strtab_encoder(byte_order, addr_size);
+  ConstStringTable const_strtab;
+  object.Encode(file, const_strtab);
+  llvm::ArrayRef bytes = file.GetData();
+  DataExtractor data(bytes.data(), bytes.size(), byte_order, addr_size);
+
+  const_strtab.Encode(strtab_encoder);
+  llvm::ArrayRef strtab_bytes = strtab_encoder.GetData();
+  DataExtractor strtab_data(strtab_bytes.data(), strtab_bytes.size(),
+byte_order, addr_size);
+  StringTableReader strtab_reader;
+  offset_t strtab_data_offset = 0;
+  ASSERT_EQ(strtab_reader.Decode(strtab_data, &strtab_data_offset), true);
+
+  Symbol decoded_object;
+  offset_t data_offset = 0;
+  decoded_object.Decode(data, &data_offset, sect_list, strtab_reader);
+  EXPECT_EQ(object, decoded_object);
+}
+
+static void EncodeDecode(const Symbol &object, const SectionList *sect_list) 

[Lldb-commits] [PATCH] D115324: Added the ability to cache the finalized symbol tables subsequent debug sessions to start faster.

2021-12-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg marked 6 inline comments as done.
clayborg added a comment.

Pavel: I fixed all issues you identified. Let me know if there is anything else 
you would like to see changed.




Comment at: lldb/source/Host/common/FileSystem.cpp:523
+  Status error;
+  if (IsDirectory(path))
+error.SetErrorStringWithFormatv("\"{0}\" is a directory",

labath wrote:
> What's the purpose of this check ?
I checked the llvm code, and it already correctly handles not deleting a file 
if it is a directory, so this isn't needed.



Comment at: lldb/source/Symbol/Symbol.cpp:645
+  file.AppendU16(m_type_data);
+  file.AppendU16((&m_type_data)[1]);
+  m_mangled.Encode(file, strtab);

labath wrote:
> This is quite dodgy. It would be better to change the storage so that we 
> don't have to do this. Perhaps something like
> ```
> union {
>   uint16_t flag_storage;
>   struct {
> uint16_t m_type_data_resolved : 1;
> ...
>   };
> };
> ```
I encoded them manually now. It was too disruptive to the code to try and add 
an anonymous union with an anonymous struct as there were many compiler 
warnings about it being a GNU extension and made the code way too messy, 
especially in the constructor as you can't init each value easily.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115324/new/

https://reviews.llvm.org/D115324

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