[Lldb-commits] [PATCH] D79699: Add ptrace register access for AArch64 SVE registers

2020-05-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 263935.
omjavaid added a comment.

This new updated patch overrides GetRegisterInfoAtIndex in 
NativeRegisterContextLinux_arm64 to reduce the impacts of register numbering 
conversion on the generic LLGS code.


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

https://reviews.llvm.org/D79699

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
  lldb/test/API/commands/register/register/aarch64_sve_registers/Makefile
  
lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py
  lldb/test/API/commands/register/register/aarch64_sve_registers/main.c

Index: lldb/test/API/commands/register/register/aarch64_sve_registers/main.c
===
--- /dev/null
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/main.c
@@ -0,0 +1,5 @@
+int main() {
+  asm volatile("ptrue p0.s\n\t");
+  asm volatile("fcpy  z0.s, p0/m, #5.\n\t");
+  return 0; // Set a break point here.
+}
\ No newline at end of file
Index: lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py
===
--- /dev/null
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/TestSVERegisters.py
@@ -0,0 +1,128 @@
+"""
+Test the AArch64 SVE registers.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class RegisterCommandsTestCase(TestBase):
+
+def check_sve_register_size(self, set, name, expected):
+reg_value = set.GetChildMemberWithName(name)
+self.assertTrue(reg_value.IsValid(),
+'Verify we have a register named "%s"' % (name))
+self.assertEqual(reg_value.GetByteSize(), expected,
+ 'Verify "%s" == %i' % (name, expected))
+
+mydir = TestBase.compute_mydir(__file__)
+@skipIf
+def test_sve_registers_configuration(self):
+"""Test AArch64 SVE registers size configuration."""
+self.build()
+self.line = line_number('main.c', '// Set a break point here.')
+
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(self, "main.c", self.line, num_expected_locations=1)
+self.runCmd("run", RUN_SUCCEEDED)
+
+self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ["stop reason = breakpoint 1."])
+
+target = self.dbg.GetSelectedTarget()
+process = target.GetProcess()
+thread = process.GetThreadAtIndex(0)
+currentFrame = thread.GetFrameAtIndex(0)
+
+has_sve = False
+for registerSet in currentFrame.GetRegisters():
+if 'sve registers' in registerSet.GetName().lower():
+has_sve = True
+
+if not has_sve:
+self.skipTest('SVE registers must be supported.')
+
+registerSets = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetRegisters()
+
+sve_registers = registerSets.GetValueAtIndex(2)
+
+vg_reg = sve_registers.GetChildMemberWithName("vg")
+
+vg_reg_value = sve_registers.GetChildMemberWithName("vg").GetValueAsUnsigned()
+
+z_reg_size = vg_reg_value * 8
+
+p_reg_size = z_reg_size / 8
+
+for i in range(32):
+self.check_sve_register_size(sve_registers, 'z%i' % (i), z_reg_size)
+
+for i in range(16):
+self.check_sve_register_size(sve_registers, 'p%i' % (i), p_reg_size)
+
+self.check_sve_register_size(sve_registers, 'ffr', p_reg_size)
+
+mydir = TestBase.compute_mydir(__file__)
+@no_debug_info_test
+@skipIf
+def test_sve_registers_read_write(self):
+"""Test AArch64 SVE registers read and write."""
+self.build()
+self.line = line_number('main.c', '// Set a break point here.')
+
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(self, "main.c", self.line, num_expected_locations=1)
+self.runCmd("run", RUN_SUCCEEDED)
+
+self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ["stop reason = breakpoint 1."])
+
+target = self.dbg.GetSelectedTarget()
+process = target.GetProcess()
+thread = process.GetThreadAtIndex(0)
+currentFrame = thread.GetFrameAtIndex(0)
+
+has_sve = False
+for registerSet in currentFrame.GetRegisters():
+if 'sve registers' in registerSet.GetName().lower():
+has_sve = T

[Lldb-commits] [PATCH] D77043: Fix process gdb-remote usage of value_regs/invalidate_regs

2020-05-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 263937.
omjavaid added a comment.

This updated diff reduces impact of register numbering correction on LLGS code 
by removing UserRegIndexToRegInfosIndex out of the code and instead overriding 
GetRegisterInfoAtIndex in NativeRegisterContextLinux_arm64.


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

https://reviews.llvm.org/D77043

Files:
  lldb/include/lldb/Host/common/NativeRegisterContext.h
  lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
  lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -242,11 +242,15 @@
   // Index of the primordial register.
   bool success = true;
   for (uint32_t idx = 0; success; ++idx) {
-const uint32_t prim_reg = reg_info->value_regs[idx];
+uint32_t prim_reg = reg_info->value_regs[idx];
 if (prim_reg == LLDB_INVALID_REGNUM)
   break;
 // We have a valid primordial register as our constituent. Grab the
 // corresponding register info.
+uint32_t regnum = ConvertRegisterKindToRegisterNumber(
+eRegisterKindProcessPlugin, prim_reg);
+if (regnum != LLDB_INVALID_REGNUM)
+  prim_reg = regnum;
 const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg);
 if (prim_reg_info == nullptr)
   success = false;
@@ -375,11 +379,15 @@
   // Invalidate this composite register first.
 
   for (uint32_t idx = 0; success; ++idx) {
-const uint32_t reg = reg_info->value_regs[idx];
+uint32_t reg = reg_info->value_regs[idx];
 if (reg == LLDB_INVALID_REGNUM)
   break;
 // We have a valid primordial register as our constituent. Grab the
 // corresponding register info.
+uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+eRegisterKindProcessPlugin, reg);
+if (lldb_regnum != LLDB_INVALID_REGNUM)
+  reg = lldb_regnum;
 const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg);
 if (value_reg_info == nullptr)
   success = false;
@@ -397,6 +405,10 @@
   for (uint32_t idx = 0, reg = reg_info->invalidate_regs[0];
reg != LLDB_INVALID_REGNUM;
reg = reg_info->invalidate_regs[++idx]) {
+uint32_t lldb_regnum = ConvertRegisterKindToRegisterNumber(
+eRegisterKindProcessPlugin, reg);
+if (lldb_regnum != LLDB_INVALID_REGNUM)
+  reg = lldb_regnum;
 SetRegisterIsValid(reg, false);
   }
 }
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -458,15 +458,18 @@
   }
 }
 
-static void CollectRegNums(const uint32_t *reg_num, StreamString &response,
+static void CollectRegNums(NativeRegisterContext ®_context,
+   const uint32_t *reg_num, StreamString &response,
bool usehex) {
+  uint32_t reg_index = 0;
   for (int i = 0; *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+reg_index = reg_context.RegInfosIndexToUserRegIndex(*reg_num);
 if (i > 0)
   response.PutChar(',');
 if (usehex)
-  response.Printf("%" PRIx32, *reg_num);
+  response.Printf("%" PRIx32, reg_index);
 else
-  response.Printf("%" PRIu32, *reg_num);
+  response.Printf("%" PRIu32, reg_index);
   }
 }
 
@@ -1820,13 +1823,13 @@
 
   if (reg_info->value_regs && reg_info->value_regs[0] != LLDB_INVALID_REGNUM) {
 response.PutCString("container-regs:");
-CollectRegNums(reg_info->value_regs, response, true);
+CollectRegNums(reg_context, reg_info->value_regs, response, true);
 response.PutChar(';');
   }
 
   if (reg_info->invalidate_regs && reg_info->invalidate_regs[0]) {
 response.PutCString("invalidate-regs:");
-CollectRegNums(reg_info->invalidate_regs, response, true);
+CollectRegNums(reg_context, reg_info->invalidate_regs, response, true);
 response.PutChar(';');
   }
 
@@ -2811,13 +2814,13 @@
 if (reg_info->value_regs &&
 reg_info->value_regs[0] != LLDB_INVALID_REGNUM) {
   response.PutCString("value_regnums=\"");
-  CollectRegNums(reg_info->value_regs, response, false);
+  CollectRegNums(reg_co

[Lldb-commits] [PATCH] D77047: AArch64 SVE register infos and core file support

2020-05-14 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 263934.
omjavaid added a comment.

New update contains minor update needed to accommodate SVE PTrace macros header 
from ARM.


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

https://reviews.llvm.org/D77047

Files:
  lldb/include/lldb/Target/RegisterContext.h
  lldb/source/Plugins/Process/Linux/LinuxPTraceDefines_arm64sve.h
  lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoInterface.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfos_arm64_sve.h
  lldb/source/Plugins/Process/Utility/lldb-arm64-register-enums.h
  lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp
  lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.h
  lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
  lldb/source/Utility/ARM64_DWARF_Registers.h
  lldb/source/Utility/ARM64_ehframe_Registers.h
  lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c
  lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.core

Index: lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c
===
--- /dev/null
+++ lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-sve.c
@@ -0,0 +1,24 @@
+// compile with -march=armv8-a+sve on compatible aarch64 compiler
+// linux-aarch64-sve.core was generated by: aarch64-linux-gnu-gcc-8
+// commandline: -march=armv8-a+sve -nostdlib -static -g linux-aarch64-sve.c
+static void bar(char *boom) {
+  char F = 'b';
+  asm volatile("ptrue p0.s\n\t");
+  asm volatile("fcpy  z0.s, p0/m, #7.5\n\t");
+  asm volatile("ptrue p1.s\n\t");
+  asm volatile("fcpy  z1.s, p1/m, #11.5\n\t");
+  asm volatile("ptrue p3.s\n\t");
+  asm volatile("fcpy  z3.s, p3/m, #15.5\n\t");
+
+  *boom = 47; // Frame bar
+}
+
+static void foo(char *boom, void (*boomer)(char *)) {
+  char F = 'f';
+  boomer(boom); // Frame foo
+}
+
+void _start(void) {
+  char F = '_';
+  foo(0, bar); // Frame _start
+}
Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -311,6 +311,47 @@
 
 self.expect("register read --all")
 
+@skipIf(triple='^mips')
+@skipIfLLVMTargetMissing("AArch64")
+def test_aarch64_sve_regs(self):
+# check 64 bit ARM core files
+target = self.dbg.CreateTarget(None)
+self.assertTrue(target, VALID_TARGET)
+process = target.LoadCore("linux-aarch64-sve.core")
+
+values = {}
+values["fp"] = "0xfc1ff4f0"
+values["lr"] = "0x00400170"
+values["sp"] = "0xfc1ff4d0"
+values["pc"] = "0x0040013c"
+values["v0"] = "{0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40}"
+values["v1"] = "{0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41}"
+values["v2"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}"
+values["v3"] = "{0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41}"
+values["s0"] = "7.5"
+values["s1"] = "11.5"
+values["s2"] = "0"
+values["s3"] = "15.5"
+values["d0"] = "65536.0158538818"
+values["d1"] = "1572864.25476074"
+values["d2"] = "0"
+values["d3"] = "25165828.0917969"
+values["vg"] = "0x0004"
+values["z0"] = "{0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40 0x00 0x00 0xf0 0x40}"
+values["z1"] = "{0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41 0x00 0x00 0x38 0x41}"
+values["z2"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}"
+values["z3"] = "{0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41 0x00 0x00 0x78 0x41}"
+values["p0"] = "{0x11 0x11 0x11 0x11}"
+values["p1"] = "{0x11 0x11 0x11 0x11}"
+values["p2"] = "{0x00 0x00 0x00 0x00}"
+values["p3"] = "{

[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

2020-05-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D78972#2035420 , @compnerd wrote:

> WeakODR requires that the symbol actually be discarded if not referenced.  
> This will preserve the symbol even if unreferenced will it not?  One approach 
> might be to just create a `DenseMap` and check for any references and mark is 
> as preserved otherwise just drop it.  However, it _is_ ODR, which means that 
> if it ever gets instantiated, we are well within our rights to give you the 
> second definition rather than the first.


The question I am stuck at here is "referenced by who". E.g. does a subsequent 
top-level expression count? If so, then we can't drop it ever, because we don't 
know if they use will try to reference it in the future?

The reason I am stuck is because it's not clear to me which "model" is our 
expression evaluation try to emulate. The model closest to the current 
implementation (and also most reasonable sounding model, for me) seems to be to 
treat each expression as if it was defined in a separate translation unit, and 
then "linked" together. In that world, I think we should basically treat all 
non-private (static) linkage types as "external", as all of these are visible 
in other TUs (with slightly differing semantics, which are also hard to nail 
down because of the strangeness of the debugger expression evaluation model).

OTOH, in this model, it should be possible to declare the same "static" 
variable/function twice, but this currently fails with:

  (lldb) expr --top-level -- static void myfunc() {}
  (lldb) expr --top-level -- static void myfunc() {}
  error: :1:13: redefinition of 'myfunc'
  static void myfunc() {}
  ^
  :1:13: previous definition is here
  static void myfunc() {}
  ^

If that is intentional (i.e., not a bug) then a closer model would be to treat 
all expressions as belonging to a single translation unit, and the notion of 
externality does not make much sense (we could treat pretty much all linkage 
types the same way).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78972



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


[Lldb-commits] [PATCH] D79811: WIP: Reenable creation of artificial methods in AddMethodToCXXRecordType(...)

2020-05-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D79811#2035631 , @clayborg wrote:

> In D79811#2035078 , @shafik wrote:
>
> > In D79811#2034842 , @clayborg 
> > wrote:
> >
> > > The error where two of the same classes conflicted usually only  happened 
> > > in complex cases that were hard to reduce down.
> > >
> > > If I understand this correctly, the compiler should be able to auto 
> > > synthesize these functions at will since the original class definition 
> > > should have all of the information it needs to create them. So why do we 
> > > need these to be added? Seems like the wrong approach IMHO. I would like 
> > > the hear the justification for needing to add artificial functions to a 
> > > class definition before we entertain this more. Can you elaborate on why 
> > > you think these are needed?
> >
> >
> > Yes, the test case below shows that if we don't add the method then during 
> > expression evaluation of let's say:
> >
> >   A{}
> >
> >
> > The `default member initializer` won't be done. So `x` won't be initialized 
> > to `10` and the default constructor for `cse` will be called instead of 
> > `ClassForSideEffect(int)`.
>
>
> So that sounds like a compiler bug or something that we are not setting up 
> right in the class type when we convert it from DWARF. Can you compile a 
> quick example and dump the AST somehow and then compare it to the class we 
> generate from debug info and see how they differ?


The DWARF will not contain the description of the `=10` part of `int x=10;` in 
the class definition. Without it, we don't have a way to know what the default 
constructor will do. It's true that for this variable, the compiler could emit 
`DW_AT_default_value(10)` to describe that, but the approach does not seem 
feasible in general -- the RHS can be an arbitrarily complex expression, 
referencing other functions, variables, etc.

It seems to me you're assigning more power to DW_AT_artificial than what it 
actually does. All that attribute says is that the entity was generated by the 
compiler ("Objects or types that are not actually declared in the source" in 
spec's own words). It does not mean that its semantics are fully described by 
the rest of the debug info. Since the compiler was able to generate that 
function, its semantics must have been fully described by the _source_ code, 
but dwarf also does not claim to describe the entirety of the source code.

Before c++11 came along with default initializers, it was mostly correct to say 
that "artificial" default constructors could be regenerated from dwarf at will 
-- because all that constructor could do is default-initialize all sub-objects. 
However, that is no longer the case...


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

https://reviews.llvm.org/D79811



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


[Lldb-commits] [lldb] f665e80 - [lldb] Don't dissasemble large functions by default

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T11:52:54+02:00
New Revision: f665e80c023ec52557f55d7eeaf34471e4c6fa0d

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

LOG: [lldb] Don't dissasemble large functions by default

Summary:
If we have a binary without symbol information (and without
LC_FUNCTION_STARTS, if on a mac), then we have to resort to using
heuristics to determine the function boundaries. However, these don't
always work, and so we can easily end up thinking we have functions
which are several megabytes in size. Attempting to (accidentally)
disassemble these can take a very long time spam the terminal with
thousands of lines of disassembly.

This patch works around that problem by adding a sanity check to the
disassemble command. If we are about to disassemble a function which is
larger than a certain threshold, we will refuse to disassemble such a
function unless the user explicitly specifies the number of instructions
to disassemble, uses start/stop addresses for disassembly, or passes the
(new) --force argument.

The threshold is currently fairly aggressive (4000 bytes ~~ 1000
instructions). If needed, we can increase it, or even make it
configurable.

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

Added: 


Modified: 
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectDisassemble.h
lldb/source/Commands/Options.td
lldb/test/Shell/Commands/Inputs/command-disassemble.lldbinit
lldb/test/Shell/Commands/command-disassemble-process.yaml
lldb/test/Shell/Commands/command-disassemble.s

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 511cd6995404..d522d63b6d0d 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -21,8 +21,9 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 
-#define DEFAULT_DISASM_BYTE_SIZE 32
-#define DEFAULT_DISASM_NUM_INS 4
+static constexpr unsigned default_disasm_byte_size = 32;
+static constexpr unsigned default_disasm_num_ins = 4;
+static constexpr unsigned large_function_threshold = 4000;
 
 using namespace lldb;
 using namespace lldb_private;
@@ -143,6 +144,10 @@ Status 
CommandObjectDisassemble::CommandOptions::SetOptionValue(
 }
   } break;
 
+  case '\x01':
+force = true;
+break;
+
   default:
 llvm_unreachable("Unimplemented option");
   }
@@ -186,6 +191,7 @@ void 
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
 
   arch.Clear();
   some_location_specified = false;
+  force = false;
 }
 
 Status CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
@@ -214,6 +220,21 @@ CommandObjectDisassemble::CommandObjectDisassemble(
 
 CommandObjectDisassemble::~CommandObjectDisassemble() = default;
 
+llvm::Error CommandObjectDisassemble::CheckRangeSize(const AddressRange &range,
+ llvm::StringRef what) {
+  if (m_options.num_instructions > 0 || m_options.force ||
+  range.GetByteSize() < large_function_threshold)
+return llvm::Error::success();
+  StreamString msg;
+  msg << "Not disassembling " << what << " because it is very large ";
+  range.Dump(&msg, &GetSelectedTarget(), Address::DumpStyleLoadAddress,
+ Address::DumpStyleFileAddress);
+  msg << ". To disassemble specify an instruction count limit, start/stop "
+ "addresses or use the --force option.";
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ msg.GetString());
+}
+
 llvm::Expected>
 CommandObjectDisassemble::GetContainingAddressRanges() {
   std::vector ranges;
@@ -254,6 +275,9 @@ CommandObjectDisassemble::GetContainingAddressRanges() {
 "Could not find function bounds for address 0x%" PRIx64,
 m_options.symbol_containing_addr);
   }
+
+  if (llvm::Error err = CheckRangeSize(ranges[0], "the function"))
+return std::move(err);
   return ranges;
 }
 
@@ -273,8 +297,10 @@ CommandObjectDisassemble::GetCurrentFunctionRanges() {
   else if (sc.symbol && sc.symbol->ValueIsAddress()) {
 range = {sc.symbol->GetAddress(), sc.symbol->GetByteSize()};
   } else
-range = {frame->GetFrameCodeAddress(), DEFAULT_DISASM_BYTE_SIZE};
+range = {frame->GetFrameCodeAddress(), default_disasm_byte_size};
 
+  if (llvm::Error err = CheckRangeSize(range, "the current function"))
+return std::move(err);
   return std::vector{range};
 }
 
@@ -298,7 +324,7 @@ CommandObjectDisassemble::GetCurrentLineRanges() {
 }
 
 llvm::Expected>
-CommandObjectDisassemble::GetNameRanges() {
+CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
   ConstString name(m_options.f

[Lldb-commits] [lldb] 3a16829 - [lldb] Switch Section-dumping code to raw_ostream

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T11:59:18+02:00
New Revision: 3a16829748a1ed208a37c719d3a3bcca50dcbd0f

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

LOG: [lldb] Switch Section-dumping code to raw_ostream

Also, add a basic test for dumping sections.

Added: 
lldb/test/Shell/Commands/command-target-modules-dump-sections.yaml

Modified: 
lldb/include/lldb/Core/Section.h
lldb/source/API/SBSection.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/Address.cpp
lldb/source/Core/Section.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Target/SectionLoadList.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Section.h 
b/lldb/include/lldb/Core/Section.h
index 8e3adcfc0ece..3be9bc770be5 100644
--- a/lldb/include/lldb/Core/Section.h
+++ b/lldb/include/lldb/Core/Section.h
@@ -29,7 +29,6 @@ class Address;
 class DataExtractor;
 class ObjectFile;
 class Section;
-class Stream;
 class Target;
 
 class SectionList {
@@ -56,7 +55,8 @@ class SectionList {
 
   bool ContainsSection(lldb::user_id_t sect_id) const;
 
-  void Dump(Stream *s, Target *target, bool show_header, uint32_t depth) const;
+  void Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
+bool show_header, uint32_t depth) const;
 
   lldb::SectionSP FindSectionByName(ConstString section_dstr) const;
 
@@ -127,9 +127,10 @@ class Section : public 
std::enable_shared_from_this,
 
   const SectionList &GetChildren() const { return m_children; }
 
-  void Dump(Stream *s, Target *target, uint32_t depth) const;
+  void Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
+uint32_t depth) const;
 
-  void DumpName(Stream *s) const;
+  void DumpName(llvm::raw_ostream &s) const;
 
   lldb::addr_t GetLoadBaseAddress(Target *target) const;
 

diff  --git a/lldb/source/API/SBSection.cpp b/lldb/source/API/SBSection.cpp
index be53d33fb7a3..bb56fa18d9ca 100644
--- a/lldb/source/API/SBSection.cpp
+++ b/lldb/source/API/SBSection.cpp
@@ -281,7 +281,7 @@ bool SBSection::GetDescription(SBStream &description) {
 const addr_t file_addr = section_sp->GetFileAddress();
 strm.Printf("[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") ", file_addr,
 file_addr + section_sp->GetByteSize());
-section_sp->DumpName(&strm);
+section_sp->DumpName(strm.AsRawOstream());
   } else {
 strm.PutCString("No value");
   }

diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8db0eef31163..41a6135f340c 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1442,11 +1442,9 @@ static void DumpModuleSections(CommandInterpreter 
&interpreter, Stream &strm,
   strm.Printf("Sections for '%s' (%s):\n",
   module->GetSpecificationDescription().c_str(),
   module->GetArchitecture().GetArchitectureName());
-  strm.IndentMore();
-  section_list->Dump(&strm,
+  section_list->Dump(strm.AsRawOstream(), strm.GetIndentLevel() + 2,
  interpreter.GetExecutionContext().GetTargetPtr(), 
true,
  UINT32_MAX);
-  strm.IndentLess();
 }
   }
 }

diff  --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 257b2b64792e..9d52f1db8918 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -415,7 +415,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope 
*exe_scope, DumpStyle style,
 
   case DumpStyleSectionNameOffset:
 if (section_sp) {
-  section_sp->DumpName(s);
+  section_sp->DumpName(s->AsRawOstream());
   s->Printf(" + %" PRIu64, m_offset);
 } else {
   DumpAddress(s->AsRawOstream(), m_offset, addr_size);

diff  --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 3809604566e9..ce4715721ee7 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -13,7 +13,6 @@
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/FileSpec.h"
-#include "lldb/Utility/Stream.h"
 #include "lldb/Utility/VMRange.h"
 
 #include 
@@ -283,15 +282,15 @@ bool Section::ContainsFileAddress(addr_t vm_addr) const {
   return false;
 }
 
-void Section::Dump(Stream *s, Target *target, uint32_t depth) const {
-  //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
-  s->Indent();
-  s->Printf("0x%8.8" PRIx64 " %-16s ", GetID(), GetTypeAsCString());
+void Section::Dump(llvm::ra

[Lldb-commits] [PATCH] D79789: [lldb] Don't dissasemble large functions by default

2020-05-14 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf665e80c023e: [lldb] Don't dissasemble large functions 
by default (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79789

Files:
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/Options.td
  lldb/test/Shell/Commands/Inputs/command-disassemble.lldbinit
  lldb/test/Shell/Commands/command-disassemble-process.yaml
  lldb/test/Shell/Commands/command-disassemble.s

Index: lldb/test/Shell/Commands/command-disassemble.s
===
--- lldb/test/Shell/Commands/command-disassemble.s
+++ lldb/test/Shell/Commands/command-disassemble.s
@@ -51,8 +51,19 @@
 # CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>:  int$0x14
 # CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int$0x15
 # CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int$0x16
-# CHECK-NEXT: (lldb) disassemble --address 0xdead
-# CHECK-NEXT: error: Could not find function bounds for address 0xdead
+# CHECK-NEXT: (lldb) disassemble --address 0xdeadb
+# CHECK-NEXT: error: Could not find function bounds for address 0xdeadb
+# CHECK-NEXT: (lldb) disassemble --address 0x100
+# CHECK-NEXT: error: Not disassembling the function because it is very large [0x0040-0x2040). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
+# CHECK-NEXT: (lldb) disassemble --address 0x100 --count 3
+# CHECK-NEXT: command-disassemble.s.tmp`very_long:
+# CHECK-NEXT: command-disassemble.s.tmp[0x40] <+0>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x42] <+2>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x44] <+4>: int$0x2a
+# CHECK-NEXT: (lldb) disassemble --address 0x100 --force
+# CHECK-NEXT: command-disassemble.s.tmp`very_long:
+# CHECK-NEXT: command-disassemble.s.tmp[0x40]   <+0>:int$0x2a
+# CHECK:  command-disassemble.s.tmp[0x203e] <+8190>: int$0x2a
 # CHECK-NEXT: (lldb) disassemble --start-address 0x0 --count 7
 # CHECK-NEXT: command-disassemble.s.tmp`foo:
 # CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>:  int$0x10
@@ -64,8 +75,32 @@
 # CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int$0x16
 # CHECK-NEXT: (lldb) disassemble --start-address 0x0 --end-address 0x20 --count 7
 # CHECK-NEXT: error: invalid combination of options for the given command
-# CHECK-NEXT: (lldb) disassemble --address 0x0 --count 7
-# CHECK-NEXT: error: invalid combination of options for the given command
+# CHECK-NEXT: (lldb) disassemble --name case1
+# CHECK-NEXT: command-disassemble.s.tmp`n1::case1:
+# CHECK-NEXT: command-disassemble.s.tmp[0x2040] <+0>: int$0x30
+# CHECK-EMPTY:
+# CHECK-NEXT: command-disassemble.s.tmp`n2::case1:
+# CHECK-NEXT: command-disassemble.s.tmp[0x2042] <+0>: int$0x31
+# CHECK-EMPTY:
+# CHECK-NEXT: (lldb) disassemble --name case2
+# CHECK-NEXT: command-disassemble.s.tmp`n1::case2:
+# CHECK-NEXT: command-disassemble.s.tmp[0x2044] <+0>: int$0x32
+# CHECK-NEXT: warning: Not disassembling a range because it is very large [0x2046-0x4046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
+# CHECK-NEXT: (lldb) disassemble --name case3
+# CHECK-NEXT: error: Not disassembling a range because it is very large [0x4046-0x6046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
+# CHECK-NEXT: Not disassembling a range because it is very large [0x6046-0x8046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
+# CHECK-NEXT: (lldb) disassemble --name case3 --count 3
+# CHECK-NEXT: command-disassemble.s.tmp`n1::case3:
+# CHECK-NEXT: command-disassemble.s.tmp[0x4046] <+0>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x4048] <+2>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x404a] <+4>: int$0x2a
+# CHECK-EMPTY:
+# CHECK-NEXT: command-disassemble.s.tmp`n2::case3:
+# CHECK-NEXT: command-disassemble.s.tmp[0x6046] <+0>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x6048] <+2>: int$0x2a
+# CHECK-NEXT: command-disassemble.s.tmp[0x604a] <+4>: int$0x2a
+# CHECK-EMPTY:
+
 
 .text
 foo:
@@ -102,3 +137,32 @@
 int $0x2d
 int $0x2e
 int $0x2f
+
+very_long:
+.rept 0x1000
+int $42
+.endr
+
+_ZN2n15case1Ev:
+int $0x30
+
+_ZN2n25case1Ev:
+int $0x31
+
+_ZN2n15case2Ev:
+int $0x32
+
+_ZN2n25case2Ev:
+.rept 0x1000
+int $42
+.endr
+
+_ZN2n15case3Ev:
+.rept 0x1000
+int $42
+.endr
+
+_ZN2n25case3Ev:
+.rept 0x1000
+int $42
+.endr
Index: lldb/test/Sh

[Lldb-commits] [lldb] deea174 - [lldb/gdb-remote] Change default value of use-libraries-svr4 to true

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T12:17:37+02:00
New Revision: deea174ee508c84652785e55f54c81fd1fba492c

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

LOG: [lldb/gdb-remote] Change default value of use-libraries-svr4 to true

This setting was added last year, defaulting to false. There have been
no bug reports about the svr4 code path since then, and the using this
packet is definitely faster than walking the module list from lldb.

Set the default value of the setting to true, as that is a better
default. Users can still change it back if encountering problems, or we
can revert the change as well, in case of bigger issues.

I also add a note to the setting description that it is only effective
if lldb is built with xml support.

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td
index 9cbe3d40ca2c..d4c3c8b94b7e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td
@@ -11,8 +11,8 @@ let Definition = "processgdbremote" in {
 Desc<"The file that provides the description for remote target 
registers.">;
   def UseSVR4: Property<"use-libraries-svr4", "Boolean">,
 Global,
-DefaultFalse,
-Desc<"If true, the libraries-svr4 feature will be used to get a hold of 
the process's loaded modules.">;
+DefaultTrue,
+Desc<"If true, the libraries-svr4 feature will be used to get a hold of 
the process's loaded modules. This setting is only effective if lldb was build 
with xml support.">;
   def UseGPacketForReading: Property<"use-g-packet-for-reading", "Boolean">,
 Global,
 DefaultFalse,



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


[Lldb-commits] [lldb] dac6e9c - [lldb] Fix a "missing return" warning in XcodeSDK

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T13:31:49+02:00
New Revision: dac6e9ca2190b7ece67ab7b62ea113d3ade5067a

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

LOG: [lldb] Fix a "missing return" warning in XcodeSDK

Added: 


Modified: 
lldb/source/Utility/XcodeSDK.cpp

Removed: 




diff  --git a/lldb/source/Utility/XcodeSDK.cpp 
b/lldb/source/Utility/XcodeSDK.cpp
index ae46042f7d2d..d5ef8e2951ff 100644
--- a/lldb/source/Utility/XcodeSDK.cpp
+++ b/lldb/source/Utility/XcodeSDK.cpp
@@ -41,6 +41,7 @@ static llvm::StringRef GetName(XcodeSDK::Type type) {
   case XcodeSDK::unknown:
 return {};
   }
+  llvm_unreachable("Unhandled sdk type!");
 }
 
 XcodeSDK::XcodeSDK(XcodeSDK::Info info) : m_name(GetName(info.type).str()) {



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


[Lldb-commits] [lldb] 638efe3 - [lldb] Use llvm::MC for register numbers in AArch64 ABIs

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T13:31:48+02:00
New Revision: 638efe3929cd3f62590462434d6397c150ad78ed

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

LOG: [lldb] Use llvm::MC for register numbers in AArch64 ABIs

Summary:
This is equivalent to previous patches (e.g. 07355c1c0) for the x86 ABIs.

One name fixup is needed -- lldb refers to the floating/vector registers by
their vector name (vN). Llvm does not use this name, so we map it to qN,
representing the register as a single 128 bit value (this choice is fairly
arbitrary -- any other name would also work fine as they all have the same
DWARF number).

Reviewers: JDevlieghere, jasonmolenda, omjavaid

Reviewed By: omjavaid

Subscribers: clayborg, danielkiss, aprantl, kristof.beyls, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h

Removed: 




diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
index 43cc4c3cd87b..5cf9fb4ad37f 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
@@ -1,4 +1,4 @@
-//===-- AArch64.h 
-===//
+//===-- AArch66.h 
-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,6 +9,7 @@
 #include "ABIAArch64.h"
 #include "ABIMacOSX_arm64.h"
 #include "ABISysV_arm64.h"
+#include "Utility/ARM64_DWARF_Registers.h"
 #include "lldb/Core/PluginManager.h"
 
 LLDB_PLUGIN_DEFINE(ABIAArch64)
@@ -22,3 +23,30 @@ void ABIAArch64::Terminate() {
   ABISysV_arm64::Terminate();
   ABIMacOSX_arm64::Terminate();
 }
+
+std::pair
+ABIAArch64::GetEHAndDWARFNums(llvm::StringRef name) {
+  if (name == "pc")
+return {LLDB_INVALID_REGNUM, arm64_dwarf::pc};
+  if (name == "cpsr")
+return {LLDB_INVALID_REGNUM, arm64_dwarf::cpsr};
+  return MCBasedABI::GetEHAndDWARFNums(name);
+}
+
+uint32_t ABIAArch64::GetGenericNum(llvm::StringRef name) {
+  return llvm::StringSwitch(name)
+  .Case("pc", LLDB_REGNUM_GENERIC_PC)
+  .Case("lr", LLDB_REGNUM_GENERIC_RA)
+  .Case("sp", LLDB_REGNUM_GENERIC_SP)
+  .Case("fp", LLDB_REGNUM_GENERIC_FP)
+  .Case("cpsr", LLDB_REGNUM_GENERIC_FLAGS)
+  .Case("x0", LLDB_REGNUM_GENERIC_ARG1)
+  .Case("x1", LLDB_REGNUM_GENERIC_ARG2)
+  .Case("x2", LLDB_REGNUM_GENERIC_ARG3)
+  .Case("x3", LLDB_REGNUM_GENERIC_ARG4)
+  .Case("x4", LLDB_REGNUM_GENERIC_ARG5)
+  .Case("x5", LLDB_REGNUM_GENERIC_ARG6)
+  .Case("x6", LLDB_REGNUM_GENERIC_ARG7)
+  .Case("x7", LLDB_REGNUM_GENERIC_ARG8)
+  .Default(LLDB_INVALID_REGNUM);
+}

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h 
b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
index 296b6d7a6c91..981145e2017e 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
+++ b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
@@ -9,9 +9,24 @@
 #ifndef LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABIAARCH64_H
 #define LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABIAARCH64_H
 
-class ABIAArch64 {
+#include "lldb/Target/ABI.h"
+
+class ABIAArch64: public lldb_private::MCBasedABI {
 public:
   static void Initialize();
   static void Terminate();
+
+protected:
+  std::pair
+  GetEHAndDWARFNums(llvm::StringRef name) override;
+
+  std::string GetMCName(std::string reg) override {
+MapRegisterName(reg, "v", "q");
+return reg;
+  }
+
+  uint32_t GetGenericNum(llvm::StringRef name) override;
+
+  using lldb_private::MCBasedABI::MCBasedABI;
 };
 #endif

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index 8ba63b9ba4a1..983da26a2a6d 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -35,1626 +35,6 @@ using namespace lldb_private;
 
 static const char *pluginDesc = "Mac OS X ABI for arm64 targets";
 
-static RegisterInfo g_register_infos[] = {
-//  NAME   ALT   SZ OFF ENCODING  FORMAT
-//  EH_FRAME DWARF  GENERIC
-//  PROCESS PLUGIN  LLDB NATIVE
-//  == ===   == === = ===
-//  ===  == ===
-//  === ==

[Lldb-commits] [PATCH] D75607: [lldb] Use llvm::MC for register numbers in AArch64 ABIs

2020-05-14 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG638efe3929cd: [lldb] Use llvm::MC for register numbers in 
AArch64 ABIs (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75607

Files:
  lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
  lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h

Index: lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
===
--- lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
+++ lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
@@ -9,10 +9,10 @@
 #ifndef LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABISYSV_ARM64_H
 #define LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABISYSV_ARM64_H
 
-#include "lldb/Target/ABI.h"
+#include "Plugins/ABI/AArch64/ABIAArch64.h"
 #include "lldb/lldb-private.h"
 
-class ABISysV_arm64 : public lldb_private::RegInfoBasedABI {
+class ABISysV_arm64 : public ABIAArch64 {
 public:
   ~ABISysV_arm64() override = default;
 
@@ -65,9 +65,6 @@
 return true;
   }
 
-  const lldb_private::RegisterInfo *
-  GetRegisterInfoArray(uint32_t &count) override;
-
   bool GetPointerReturnRegister(const char *&name) override;
 
   // Static Functions
@@ -92,7 +89,7 @@
lldb_private::CompilerType &ast_type) const override;
 
 private:
-  using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.
+  using ABIAArch64::ABIAArch64; // Call CreateInstance instead.
 };
 
 #endif // LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABISYSV_ARM64_H
Index: lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
===
--- lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
+++ lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
@@ -33,1626 +33,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static RegisterInfo g_register_infos[] = {
-//  NAME   ALT   SZ OFF ENCODING  FORMAT
-//  EH_FRAME DWARF  GENERIC
-//  PROCESS PLUGIN  LLDB NATIVE
-//  == ===   == === = ===
-//  ===  == ===
-//  === ==
-{"x0",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x0, LLDB_REGNUM_GENERIC_ARG1,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x1",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x1, LLDB_REGNUM_GENERIC_ARG2,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x2",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x2, LLDB_REGNUM_GENERIC_ARG3,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x3",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x3, LLDB_REGNUM_GENERIC_ARG4,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x4",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x4, LLDB_REGNUM_GENERIC_ARG5,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x5",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x5, LLDB_REGNUM_GENERIC_ARG6,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x6",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x6, LLDB_REGNUM_GENERIC_ARG7,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x7",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x7, LLDB_REGNUM_GENERIC_ARG8,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x8",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, arm64_dwarf::x8, LLDB_INVALID_REGNUM,
-  LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM},
- nullptr,
- nullptr,
- nullptr,
- 0},
-{"x9",
- nullptr,
- 8,
- 0,
- eEncodingUint,
- eFormatHex,
- {LLDB_INVALID_REGNUM, ar

[Lldb-commits] [PATCH] D79811: WIP: Reenable creation of artificial methods in AddMethodToCXXRecordType(...)

2020-05-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: dblaikie.
labath added a comment.

Here's another interesting use of aritificial functions: inherited constructors.

  struct A { A(int); };
  struct B:A { using A::A; };
  B b(2);

The constructor B::B(int) will be marked artificial, but it is also not 
reconstructible from the debug info because it use explicit default 
initializers for all members in `B` (if they existed -- this example does not 
have any).

This example also demonstrates what I believe *is* a bug in the compiler. The 
inherited constructor will get `DW_AT_name(A)`:

  0x003f:   DW_TAG_structure_type
  DW_AT_calling_convention  (DW_CC_pass_by_value)
  DW_AT_name("B")
  DW_AT_byte_size   (0x01)
  DW_AT_decl_file   ("/home/pavelo/ll/build/opt/")
  DW_AT_decl_line   (1)
  
  0x0048: DW_TAG_inheritance
DW_AT_type  (0x005f "A")
DW_AT_data_member_location  (0x00)
  
  0x004e: DW_TAG_subprogram
DW_AT_name  ("A")
DW_AT_declaration   (true)
DW_AT_artificial(true)
DW_AT_external  (true)

That doesn't sound correct to me. Gcc emits the name as `B`, which seems to be 
much better. Looping in @dblaikie for thoughts.


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

https://reviews.llvm.org/D79811



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


[Lldb-commits] [lldb] eb50b64 - [lldb/PDB] Make "native" pdb tests host-independent

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-05-14T16:01:23+02:00
New Revision: eb50b643fe00171823e055f7801e6610ee7bdef7

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

LOG: [lldb/PDB] Make "native" pdb tests host-independent

These test don't execute the binaries they build, and so they don't need
to build for the host. By hardcoding the target, we don't have do xfail
or skip them for targets which don't have the appropriate support in
clang(-cl).

Added: 


Modified: 
lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp
lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp
lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp
lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp
lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp
lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp
lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
index 1fee27503d2a..7eb7a2cbe7d9 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
@@ -1,8 +1,8 @@
-// XFAIL: target-arm && linux-gnu
 // clang-format off
-// REQUIRES: lld
+// REQUIRES: lld, x86
 
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
+// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
+// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f8187598be35..fb1c8e116af4 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
@@ -1,8 +1,8 @@
-// XFAIL: target-arm && linux-gnu
 // clang-format off
-// REQUIRES: lld
+// REQUIRES: lld, x86
 
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
+// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GR- -c /Fo%t.obj -- %s
+// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-methods.lldbinit 2>&1 | FileCheck %s
 

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
index bf6cd6372d8a..f3afa5d30099 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
@@ -1,9 +1,9 @@
-// XFAIL: target-arm && linux-gnu
 // clang-format off
-// REQUIRES: lld
+// REQUIRES: lld, x86
 
 // Test various interesting cases for AST reconstruction.
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
+// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
+// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/ast-types.lldbinit 2>&1 | FileCheck %s
 

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
index b56fdbaf5511..bfa3cbc81947 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
@@ -1,9 +1,9 @@
-// XFAIL: target-arm && linux-gnu
 // clang-format off
-// REQUIRES: lld
+// REQUIRES: lld, x86
 
 // Test various interesting cases for AST reconstruction.
-// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s 
+// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
+// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe 
-pdb:%t.pdb
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
 // RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
 

diff  --git a/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp 
b/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
index 8d3ab2ad3ab4..1768f127c9fa 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
@@ -1,9 +1,

[Lldb-commits] [lldb] 631048e - Moving executable module symbols parsing to target creation method.

2020-05-14 Thread Pavel Labath via lldb-commits

Author: Levon Ter-Grigoryan
Date: 2020-05-14T16:54:14+02:00
New Revision: 631048e8117864c09672e33eb7b6fcc4efe5f749

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

LOG: Moving executable module symbols parsing to target creation method.

Summary:
In our project we are using remote client-server LLDB configuration.
We want to parse as much debugging symbols as we can before debugger starts 
attachment to the remote process.
To do that we are passing the path of the local executable module to 
CreateTarget method at the client.
But, it seems that this method are not parsing the executable module symbols.
To fix this I added PreloadSymbols call for executable module to target 
creation method.

This patch also fixes a problem where the DynamicLoader would reset a
module when launching the target. We fix it by making sure
Platform::ResolveExecutable returns the module object obtained from the
remote platform.

Reviewed By: labath

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

Added: 
lldb/unittests/Target/RemoteAwarePlatformTest.cpp

Modified: 
lldb/source/Target/RemoteAwarePlatform.cpp
lldb/source/Target/TargetList.cpp
lldb/unittests/Target/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Target/RemoteAwarePlatform.cpp 
b/lldb/source/Target/RemoteAwarePlatform.cpp
index 24eb0bf5996f..f53158b06b8f 100644
--- a/lldb/source/Target/RemoteAwarePlatform.cpp
+++ b/lldb/source/Target/RemoteAwarePlatform.cpp
@@ -71,24 +71,24 @@ Status RemoteAwarePlatform::ResolveExecutable(
 }
   } else {
 if (m_remote_platform_sp) {
-  error =
-  GetCachedExecutable(resolved_module_spec, exe_module_sp,
-  module_search_paths_ptr, *m_remote_platform_sp);
-} else {
-  // We may connect to a process and use the provided executable (Don't use
-  // local $PATH).
+  return GetCachedExecutable(resolved_module_spec, exe_module_sp,
+ module_search_paths_ptr,
+ *m_remote_platform_sp);
+}
 
-  // Resolve any executable within a bundle on MacOSX
-  Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
+// We may connect to a process and use the provided executable (Don't use
+// local $PATH).
 
-  if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
-error.Clear();
-  else
-error.SetErrorStringWithFormat("the platform is not currently "
-   "connected, and '%s' doesn't exist in "
-   "the system root.",
-   exe_path);
-}
+// Resolve any executable within a bundle on MacOSX
+Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec());
+
+if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()))
+  error.Clear();
+else
+  error.SetErrorStringWithFormat("the platform is not currently "
+ "connected, and '%s' doesn't exist in "
+ "the system root.",
+ exe_path);
   }
 
   if (error.Success()) {

diff  --git a/lldb/source/Target/TargetList.cpp 
b/lldb/source/Target/TargetList.cpp
index 446cdf0c4b72..3974cb5de419 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -398,6 +398,8 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
   if (user_exe_path_is_bundle)
 exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path,
  sizeof(resolved_bundle_exe_path));
+  if (target_sp->GetPreloadSymbols())
+exe_module_sp->PreloadSymbols();
 }
   } else {
 // No file was specified, just create an empty target with any arch if a

diff  --git a/lldb/unittests/Target/CMakeLists.txt 
b/lldb/unittests/Target/CMakeLists.txt
index c04ccec75865..2c3ba699b0eb 100644
--- a/lldb/unittests/Target/CMakeLists.txt
+++ b/lldb/unittests/Target/CMakeLists.txt
@@ -4,6 +4,7 @@ add_lldb_unittest(TargetTests
   MemoryRegionInfoTest.cpp
   ModuleCacheTest.cpp
   PathMappingListTest.cpp
+  RemoteAwarePlatformTest.cpp
   StackFrameRecognizerTest.cpp
 
   LINK_LIBS

diff  --git a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp 
b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
new file mode 100644
index ..be9fbc347a2e
--- /dev/null
+++ b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
@@ -0,0 +1,94 @@
+//===-- RemoteAwarePlatformTest.cpp 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+

[Lldb-commits] [PATCH] D79757: Use IPv4 for Android connections

2020-05-14 Thread António Afonso via Phabricator via lldb-commits
aadsm added a comment.

@clayborg the support we added was for the lldb-server.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79757



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


[Lldb-commits] [PATCH] D79789: [lldb] Don't dissasemble large functions by default

2020-05-14 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Pavel, I think this broke the green dragon bots: 
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/18207/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79789



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


[Lldb-commits] [lldb] e29cae1 - [lldb/Test] Skip TestExpressionInSyscall with reproducers

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-05-14T10:38:56-07:00
New Revision: e29cae1e5340dc4c1c16c6c16af297bb69c3cef6

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

LOG: [lldb/Test] Skip TestExpressionInSyscall with reproducers

Skip this test because it relies on a timeout.

Added: 


Modified: 
lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py 
b/lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py
index a383f6911209..458a1476b449 100644
--- 
a/lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py
+++ 
b/lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py
@@ -14,6 +14,7 @@ class ExprSyscallTestCase(TestBase):
 oslist=["windows"],
 bugnumber="llvm.org/pr21765, getpid() does not exist on Windows")
 @expectedFailureNetBSD
+@skipIfReproducer
 def test_setpgid(self):
 self.build()
 self.expr_syscall()



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


[Lldb-commits] [lldb] e7c91e3 - [lldb/Test] Skip remaining 'side_effect' tests with reproducers.

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-05-14T10:38:56-07:00
New Revision: e7c91e3124b66cb1454a45dfd75c0a350852d6a6

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

LOG: [lldb/Test] Skip remaining 'side_effect' tests with reproducers.

The side_effect Python package bypasses the reproducer instrumentation
and therefore these tests are not expected to replay from a reproducer.

Added: 


Modified: 

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

lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 15a31201c565..5a6e94da594d 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -18,16 +18,18 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 @add_test_categories(['pyapi'])
+@skipIfReproducer # side_effect bypasses reproducer
 def test_step_out_python(self):
 """Test stepping out using a python breakpoint command."""
 self.build()
 self.do_set_python_command_from_python()
 
+@skipIfReproducer # side_effect bypasses reproducer
 def test_bkpt_cmd_bad_arguments(self):
 """Test what happens when pass structured data to a command:"""
 self.build()
 self.do_bad_args_to_python_command()
-
+
 def setUp(self):
 TestBase.setUp(self)
 self.main_source = "main.c"
@@ -93,7 +95,7 @@ def do_set_python_command_from_python(self):
 (error.GetCString()))
 
 self.expect("command script import --allow-reload ./bktptcmd.py")
-
+
 func_bkpt.SetScriptCallbackFunction("bktptcmd.function")
 
 extra_args = lldb.SBStructuredData()
@@ -102,11 +104,11 @@ def do_set_python_command_from_python(self):
 extra_args.SetFromJSON(stream)
 error = 
fancy_bkpt.SetScriptCallbackFunction("bktptcmd.another_function", extra_args)
 self.assertTrue(error.Success(), "Failed to add callback 
%s"%(error.GetCString()))
-
+
 stream.Clear()
 stream.Print('{"side_effect" : "I am so much fancier"}')
 extra_args.SetFromJSON(stream)
-
+
 # Fancier's callback is set up from the command line
 id = fancier_bkpt.GetID()
 self.expect("breakpoint command add -F bktptcmd.a_third_function -k 
side_effect -v 'I am fancier' %d"%(id))
@@ -115,14 +117,14 @@ def do_set_python_command_from_python(self):
 empty_args = lldb.SBStructuredData()
 error = 
not_so_fancy_bkpt.SetScriptCallbackFunction("bktptcmd.empty_extra_args", 
empty_args)
 self.assertTrue(error.Success(), "Failed to add callback 
%s"%(error.GetCString()))
-
+
 # Clear out canary variables
 side_effect.bktptcmd = None
 side_effect.callback = None
 side_effect.fancy= None
 side_effect.fancier  = None
 side_effect.not_so_fancy = None
-
+
 # Now launch the process, and do not stop at entry point.
 self.process = self.target.LaunchSimple(
 None, None, self.get_process_working_directory())
@@ -157,7 +159,7 @@ def do_bad_args_to_python_command(self):
 
 # Pass a breakpoint command function that doesn't take extra_args,
 # but pass it extra args:
-
+
 extra_args = lldb.SBStructuredData()
 stream = lldb.SBStream()
 stream.Print('{"side_effect" : "I am fancy"}')
@@ -171,4 +173,4 @@ def do_bad_args_to_python_command(self):
 
 error = bkpt.SetScriptCallbackFunction("bktptcmd.nosuch_function", 
extra_args)
 self.assertTrue(error.Fail(), "Can't pass extra args if the function 
doesn't exist.")
-
+

diff  --git 
a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
 
b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index 4c6f32b08964..afeccbef3bae 100644
--- 
a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ 
b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -15,41 +15,47 @@ class BreakpointSerialization(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 @add_test_categories(['pyapi'])
+@skipIfReproducer # side_effect bypasses reproducer
 def test_resolvers(self):
 """Use Python APIs to test that we serialize resolvers."""

[Lldb-commits] [PATCH] D78972: Treat hasWeakODRLinkage symbols as external in REPL computations

2020-05-14 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

For expression evaluation in a REPL (which we only have for Swift, but if 
somebody wants to make such a thing for C++ we wouldn't be displeased) the 
model is compiling into a single translation unit.  I think that's the only 
thing that makes sense.  You don't want to have to artificially make everything 
public in the REPL so that you could use it in a subsequent REPL session.

--top-level was introduced mostly because C doesn't allow inner functions, and 
so without a way to say "compile this expression in no function context" you 
couldn't define new functions.  That limits the utility of the expression 
parser in a seemingly artificial way, and you ended up having to write any code 
you wanted to reuse when you were using the expression parser for injecting 
code to do investigations in the inferior (like heap.py) awkward.  That doesn't 
go one way or the other to how we want to use this for more than one 
evaluation.  We could certainly discriminate between REPL and top-level in 
IRExecutionUnit and give them different behaviors.  But unless there's a good 
reason to make them different, I'd rather not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78972



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


[Lldb-commits] [PATCH] D79554: [lldb/Dataformatter] Add support to CF{Dictionary, Set}Ref types

2020-05-14 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 264038.
mib edited the summary of this revision.
mib added a comment.

Instead of creating a new empty struct type, this new implementation will use 
the opaque pointer's pointee type to create the new `ValueObjectChild`.
This makes the previously introduced helper function in `TypeSystem` and 
`TypeSystemClang` useless, so I got rid of them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79554

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSSet.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
  lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m

Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m
@@ -482,8 +482,7 @@
   CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
   NSDictionary *nscfDictionary = CFBridgingRelease(
   CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 4, nil, nil));
-  CFDictionaryRef cfDictionaryRef =
-  CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
+  CFDictionaryRef cfDictionaryRef = (__bridge CFDictionaryRef)nsDictionary;
 
   NSAttributedString *attrString =
   [[NSAttributedString alloc] initWithString:@"hello world from foo"
@@ -542,6 +541,7 @@
   [nsmutableset addObject:str4];
   NSSet *nscfSet =
   CFBridgingRelease(CFSetCreate(nil, (void *)cfValues, 2, nil));
+  CFSetRef cfSetRef = (__bridge CFSetRef)nscfSet;
 
   CFDataRef data_ref =
   CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
@@ -32,7 +32,7 @@
 '(NSDictionary *) nscfDictionary = ',
 ' 4 key/value pairs',
 '(CFDictionaryRef) cfDictionaryRef = ',
-' 3 key/value pairs',
+' 2 key/value pairs',
 '(NSDictionary *) newMutableDictionary = ',
 ' 21 key/value pairs',
 '(CFArrayRef) cfarray_ref = ',
@@ -57,10 +57,23 @@
 
 
 self.expect(
-  'frame var nscfSet',
+'frame variable -d run-target *cfDictionaryRef',
+patterns=[
+'\(const __CFDictionary\) \*cfDictionaryRef =',
+'key = 0x.* @"foo"',
+'value = 0x.* @"foo"',
+'key = 0x.* @"bar"',
+'value = 0x.* @"bar"',
+])
+
+
+self.expect(
+  'frame var nscfSet cfSetRef',
   substrs=[
   '(NSSet *) nscfSet = ',
   '2 elements',
+  '(CFSetRef) cfSetRef = ',
+  '2 elements',
   ])
 
 self.expect(
@@ -71,6 +84,14 @@
   '\[1\] = 0x.* @".*"',
 ])
 
+self.expect(
+  'frame variable -d run-target *cfSetRef',
+  patterns=[
+  '\(const __CFSet\) \*cfSetRef =',
+  '\[0\] = 0x.* @".*"',
+  '\[1\] = 0x.* @".*"',
+])
+
 self.expect(
 'frame variable iset1 iset2 imset',
 substrs=['4 indexes', '512 indexes', '10 indexes'])
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -446,6 +446,10 @@
 lldb_private::formatters::NSDictionarySummaryProvider,
 "NSDictionary summary provider", ConstString("CFDictionaryRef"),
 appkit_flags);
+  AddCXXSummary(objc_category_sp,
+lldb_private::formatters::NSDictionarySummaryProvider,
+"NSDictionary summary provider", ConstString("__CFDictionary"),
+appkit_flags);
   AddCXXSummary(objc_category_sp,
 lldb_private::formatters::NSDictionarySummaryProvider,
 "NSDictionary summary provider",
@@ -466,6 +470,9 @@
   AddCXXSummary(objc_category_sp,
 lldb_private::formatters::NSSetSummaryProvider,
 "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
+  AddCXXSumm

[Lldb-commits] [PATCH] D79953: [lldb] Update stop info override callback comment.

2020-05-14 Thread Ryan Mansfield via Phabricator via lldb-commits
rmansfield created this revision.
rmansfield added a reviewer: LLDB.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

In https://reviews.llvm.org/D31172 GetStopInfoOverrideCallback was moved and 
renamed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79953

Files:
  lldb/source/Target/Thread.cpp


Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -396,7 +396,7 @@
 // "m_stop_info_stop_id != process_stop_id" as the condition for the if
 // statement below, we must also check the stop info to see if we need to
 // override it. See the header documentation in
-// Process::GetStopInfoOverrideCallback() for more information on the stop
+// Architecture::OverrideStopInfo() for more information on the stop
 // info override callback.
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;


Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -396,7 +396,7 @@
 // "m_stop_info_stop_id != process_stop_id" as the condition for the if
 // statement below, we must also check the stop info to see if we need to
 // override it. See the header documentation in
-// Process::GetStopInfoOverrideCallback() for more information on the stop
+// Architecture::OverrideStopInfo() for more information on the stop
 // info override callback.
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D79757: Use IPv4 for Android connections

2020-05-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D79757#2036618 , @aadsm wrote:

> @clayborg the support we added was for the lldb-server.


ok, phew!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79757



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


[Lldb-commits] [PATCH] D79953: [lldb] Update stop info override callback comment.

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

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79953



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


[Lldb-commits] [PATCH] D79953: [lldb] Update stop info override callback comment.

2020-05-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Please let me know if you need me to commit this for you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79953



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


[Lldb-commits] [PATCH] D79811: WIP: Reenable creation of artificial methods in AddMethodToCXXRecordType(...)

2020-05-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I really worry enabling this will make the expression parser start to emit 
errors if we change this. The best fix would be to ensure that the AST importer 
can correctly ignore implicit functions when comparing types.


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

https://reviews.llvm.org/D79811



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


[Lldb-commits] [PATCH] D79447: [Debug][CodeView] Emit fully qualified names for globals

2020-05-14 Thread Reid Kleckner via Phabricator via lldb-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, modulo ifdef adjustment




Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:3125-3126
   } else {
 // FIXME: Currently this only emits the global variables in the IR 
metadata.
 // This should also emit enums and static data members.
 const DIExpression *DIE = CVGV.GVInfo.get();

aganea wrote:
> akhuang wrote:
> > rnk wrote:
> > > @akhuang, can we remove this FIXME? I think we addressed this simply by 
> > > changing clang to emit this metadata.
> > Yep- thanks for catching that!
> Can I leave the comment for 'enum'? There are still a few things missing in 
> the debug stream, in regards to enums (see other comment).
I'd leave the FIXME out, as you have it now. I don't think we're getting value 
from it here. At this point, it's in the frontend's hands to decide if the enum 
needs emitting, so the code fix would be far from this comment.



Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:2989
+const std::vector> &UDTs) {
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+  size_t OriginalSize = UDTs.size();

This probably needs to be `#ifndef NDEBUG`, or a build with asserts but without 
ABI breaking checks (blech) will break. Besides, it's not an ABI breaking check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79447



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


[Lldb-commits] [PATCH] D79953: [lldb] Update stop info override callback comment.

2020-05-14 Thread Ryan Mansfield via Phabricator via lldb-commits
rmansfield added a comment.

Yes, if you can commit it I'd appreciate it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79953



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


[Lldb-commits] [lldb] 5144e48 - [lldb] Update stop info override callback comment.

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Ryan Mansfield
Date: 2020-05-14T13:08:56-07:00
New Revision: 5144e48c1497e154961f22a7ac1de36c0d3e3f5d

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

LOG:  [lldb] Update stop info override callback comment.

In D31172 GetStopInfoOverrideCallback was moved and renamed.

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

Added: 


Modified: 
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 4af4abd5f6a0..f852e5546728 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -396,7 +396,7 @@ lldb::StopInfoSP Thread::GetPrivateStopInfo() {
 // "m_stop_info_stop_id != process_stop_id" as the condition for the if
 // statement below, we must also check the stop info to see if we need to
 // override it. See the header documentation in
-// Process::GetStopInfoOverrideCallback() for more information on the stop
+// Architecture::OverrideStopInfo() for more information on the stop
 // info override callback.
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;



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


[Lldb-commits] [lldb] 2d6f4fe - [lldb/Test] Skip test using files to synchronize.

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-05-14T13:08:56-07:00
New Revision: 2d6f4fec07292f1d2f77cbbf5188de3838a70b78

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

LOG: [lldb/Test] Skip test using files to synchronize.

Files written by the inferior are not captured by the reproducers and
the inferior doesn't actually run during replay.

Added: 


Modified: 
lldb/test/API/commands/settings/TestSettings.py
lldb/test/API/commands/settings/quoting/TestQuoting.py

Removed: 




diff  --git a/lldb/test/API/commands/settings/TestSettings.py 
b/lldb/test/API/commands/settings/TestSettings.py
index 29360856a735..fc872f6240fe 100644
--- a/lldb/test/API/commands/settings/TestSettings.py
+++ b/lldb/test/API/commands/settings/TestSettings.py
@@ -203,10 +203,12 @@ def test_disassembler_settings(self):
 substrs=["5ah"])
 
 @skipIfDarwinEmbedded   #  debugserver on ios etc 
can't write files
+@skipIfReproducer
 def test_run_args_and_env_vars(self):
 self.do_test_run_args_and_env_vars(use_launchsimple=False)
 
 @skipIfDarwinEmbedded   #  debugserver on ios etc 
can't write files
+@skipIfReproducer
 def test_launchsimple_args_and_env_vars(self):
 self.do_test_run_args_and_env_vars(use_launchsimple=True)
 
@@ -286,6 +288,7 @@ def do_test_run_args_and_env_vars(self, use_launchsimple):
 "Environment variable 'MY_ENV_VAR' successfully passed."])
 
 @skipIfRemote  # it doesn't make sense to send host env to remote target
+@skipIfReproducer
 def test_pass_host_env_vars(self):
 """Test that the host env vars are passed to the launched process."""
 self.build()
@@ -382,6 +385,7 @@ def unset_env_variables():
 "The host environment variable 'MY_HOST_ENV_VAR2' successfully 
passed."])
 
 @skipIfDarwinEmbedded   #  debugserver on ios etc 
can't write files
+@skipIfReproducer
 def test_set_error_output_path(self):
 """Test that setting target.error/output-path for the launched process 
works."""
 self.build()

diff  --git a/lldb/test/API/commands/settings/quoting/TestQuoting.py 
b/lldb/test/API/commands/settings/quoting/TestQuoting.py
index d7581951a147..a415ea8ee247 100644
--- a/lldb/test/API/commands/settings/quoting/TestQuoting.py
+++ b/lldb/test/API/commands/settings/quoting/TestQuoting.py
@@ -64,6 +64,7 @@ def test_bare_single(self):
 def test_bare_double(self):
 self.do_test_args('a\\"b', 'a"b\0')
 
+@skipIfReproducer # Reproducers don't know about output.txt
 def do_test_args(self, args_in, args_out):
 """Test argument parsing. Run the program with args_in. The program 
dumps its arguments
 to stdout. Compare the stdout with args_out."""



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


[Lldb-commits] [PATCH] D79953: [lldb] Update stop info override callback comment.

2020-05-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5144e48c1497:  [lldb] Update stop info override callback 
comment. (authored by rmansfield, committed by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79953

Files:
  lldb/source/Target/Thread.cpp


Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -396,7 +396,7 @@
 // "m_stop_info_stop_id != process_stop_id" as the condition for the if
 // statement below, we must also check the stop info to see if we need to
 // override it. See the header documentation in
-// Process::GetStopInfoOverrideCallback() for more information on the stop
+// Architecture::OverrideStopInfo() for more information on the stop
 // info override callback.
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;


Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -396,7 +396,7 @@
 // "m_stop_info_stop_id != process_stop_id" as the condition for the if
 // statement below, we must also check the stop info to see if we need to
 // override it. See the header documentation in
-// Process::GetStopInfoOverrideCallback() for more information on the stop
+// Architecture::OverrideStopInfo() for more information on the stop
 // info override callback.
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1cbd1b8 - Revert "[lldb] Don't dissasemble large functions by default"

2020-05-14 Thread via lldb-commits

Author: shafik
Date: 2020-05-14T14:15:51-07:00
New Revision: 1cbd1b8f692df7742efb9114510688045d901f96

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

LOG: Revert "[lldb] Don't dissasemble large functions by default"

This reverts commit f665e80c023ec52557f55d7eeaf34471e4c6fa0d.

Reverting because it breaks TestFoundationDisassembly.py

Added: 


Modified: 
lldb/source/Commands/CommandObjectDisassemble.cpp
lldb/source/Commands/CommandObjectDisassemble.h
lldb/source/Commands/Options.td
lldb/test/Shell/Commands/Inputs/command-disassemble.lldbinit
lldb/test/Shell/Commands/command-disassemble-process.yaml
lldb/test/Shell/Commands/command-disassemble.s

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
b/lldb/source/Commands/CommandObjectDisassemble.cpp
index d522d63b6d0d..511cd6995404 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -21,9 +21,8 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 
-static constexpr unsigned default_disasm_byte_size = 32;
-static constexpr unsigned default_disasm_num_ins = 4;
-static constexpr unsigned large_function_threshold = 4000;
+#define DEFAULT_DISASM_BYTE_SIZE 32
+#define DEFAULT_DISASM_NUM_INS 4
 
 using namespace lldb;
 using namespace lldb_private;
@@ -144,10 +143,6 @@ Status 
CommandObjectDisassemble::CommandOptions::SetOptionValue(
 }
   } break;
 
-  case '\x01':
-force = true;
-break;
-
   default:
 llvm_unreachable("Unimplemented option");
   }
@@ -191,7 +186,6 @@ void 
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
 
   arch.Clear();
   some_location_specified = false;
-  force = false;
 }
 
 Status CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
@@ -220,21 +214,6 @@ CommandObjectDisassemble::CommandObjectDisassemble(
 
 CommandObjectDisassemble::~CommandObjectDisassemble() = default;
 
-llvm::Error CommandObjectDisassemble::CheckRangeSize(const AddressRange &range,
- llvm::StringRef what) {
-  if (m_options.num_instructions > 0 || m_options.force ||
-  range.GetByteSize() < large_function_threshold)
-return llvm::Error::success();
-  StreamString msg;
-  msg << "Not disassembling " << what << " because it is very large ";
-  range.Dump(&msg, &GetSelectedTarget(), Address::DumpStyleLoadAddress,
- Address::DumpStyleFileAddress);
-  msg << ". To disassemble specify an instruction count limit, start/stop "
- "addresses or use the --force option.";
-  return llvm::createStringError(llvm::inconvertibleErrorCode(),
- msg.GetString());
-}
-
 llvm::Expected>
 CommandObjectDisassemble::GetContainingAddressRanges() {
   std::vector ranges;
@@ -275,9 +254,6 @@ CommandObjectDisassemble::GetContainingAddressRanges() {
 "Could not find function bounds for address 0x%" PRIx64,
 m_options.symbol_containing_addr);
   }
-
-  if (llvm::Error err = CheckRangeSize(ranges[0], "the function"))
-return std::move(err);
   return ranges;
 }
 
@@ -297,10 +273,8 @@ CommandObjectDisassemble::GetCurrentFunctionRanges() {
   else if (sc.symbol && sc.symbol->ValueIsAddress()) {
 range = {sc.symbol->GetAddress(), sc.symbol->GetByteSize()};
   } else
-range = {frame->GetFrameCodeAddress(), default_disasm_byte_size};
+range = {frame->GetFrameCodeAddress(), DEFAULT_DISASM_BYTE_SIZE};
 
-  if (llvm::Error err = CheckRangeSize(range, "the current function"))
-return std::move(err);
   return std::vector{range};
 }
 
@@ -324,7 +298,7 @@ CommandObjectDisassemble::GetCurrentLineRanges() {
 }
 
 llvm::Expected>
-CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
+CommandObjectDisassemble::GetNameRanges() {
   ConstString name(m_options.func_name.c_str());
   const bool include_symbols = true;
   const bool include_inlines = true;
@@ -335,7 +309,6 @@ CommandObjectDisassemble::GetNameRanges(CommandReturnObject 
&result) {
   name, eFunctionNameTypeAuto, include_symbols, include_inlines, sc_list);
 
   std::vector ranges;
-  llvm::Error range_errs = llvm::Error::success();
   AddressRange range;
   const uint32_t scope =
   eSymbolContextBlock | eSymbolContextFunction | eSymbolContextSymbol;
@@ -344,21 +317,14 @@ 
CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
 for (uint32_t range_idx = 0;
  sc.GetAddressRange(scope, range_idx, use_inline_block_range, range);
  ++range_idx) {
-  if (llvm::Error err = CheckRangeSize(range, "a range"))
-range_errs = joinErrors(std::move(range_errs), std::move(err));
-  else
-ranges.push_back(range);
+  ranges.p

Re: [Lldb-commits] [lldb] 1cbd1b8 - Revert "[lldb] Don't dissasemble large functions by default"

2020-05-14 Thread Jim Ingham via lldb-commits
I’m pretty sure all you need to do is add a —force to the disassemble command 
in TestFoundationDisassembly.py.

Jim


> On May 14, 2020, at 2:16 PM, via lldb-commits  
> wrote:
> 
> 
> Author: shafik
> Date: 2020-05-14T14:15:51-07:00
> New Revision: 1cbd1b8f692df7742efb9114510688045d901f96
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/1cbd1b8f692df7742efb9114510688045d901f96
> DIFF: 
> https://github.com/llvm/llvm-project/commit/1cbd1b8f692df7742efb9114510688045d901f96.diff
> 
> LOG: Revert "[lldb] Don't dissasemble large functions by default"
> 
> This reverts commit f665e80c023ec52557f55d7eeaf34471e4c6fa0d.
> 
> Reverting because it breaks TestFoundationDisassembly.py
> 
> Added: 
> 
> 
> Modified: 
>lldb/source/Commands/CommandObjectDisassemble.cpp
>lldb/source/Commands/CommandObjectDisassemble.h
>lldb/source/Commands/Options.td
>lldb/test/Shell/Commands/Inputs/command-disassemble.lldbinit
>lldb/test/Shell/Commands/command-disassemble-process.yaml
>lldb/test/Shell/Commands/command-disassemble.s
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/source/Commands/CommandObjectDisassemble.cpp 
> b/lldb/source/Commands/CommandObjectDisassemble.cpp
> index d522d63b6d0d..511cd6995404 100644
> --- a/lldb/source/Commands/CommandObjectDisassemble.cpp
> +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
> @@ -21,9 +21,8 @@
> #include "lldb/Target/StackFrame.h"
> #include "lldb/Target/Target.h"
> 
> -static constexpr unsigned default_disasm_byte_size = 32;
> -static constexpr unsigned default_disasm_num_ins = 4;
> -static constexpr unsigned large_function_threshold = 4000;
> +#define DEFAULT_DISASM_BYTE_SIZE 32
> +#define DEFAULT_DISASM_NUM_INS 4
> 
> using namespace lldb;
> using namespace lldb_private;
> @@ -144,10 +143,6 @@ Status 
> CommandObjectDisassemble::CommandOptions::SetOptionValue(
> }
>   } break;
> 
> -  case '\x01':
> -force = true;
> -break;
> -
>   default:
> llvm_unreachable("Unimplemented option");
>   }
> @@ -191,7 +186,6 @@ void 
> CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
> 
>   arch.Clear();
>   some_location_specified = false;
> -  force = false;
> }
> 
> Status CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
> @@ -220,21 +214,6 @@ CommandObjectDisassemble::CommandObjectDisassemble(
> 
> CommandObjectDisassemble::~CommandObjectDisassemble() = default;
> 
> -llvm::Error CommandObjectDisassemble::CheckRangeSize(const AddressRange 
> &range,
> - llvm::StringRef what) {
> -  if (m_options.num_instructions > 0 || m_options.force ||
> -  range.GetByteSize() < large_function_threshold)
> -return llvm::Error::success();
> -  StreamString msg;
> -  msg << "Not disassembling " << what << " because it is very large ";
> -  range.Dump(&msg, &GetSelectedTarget(), Address::DumpStyleLoadAddress,
> - Address::DumpStyleFileAddress);
> -  msg << ". To disassemble specify an instruction count limit, start/stop "
> - "addresses or use the --force option.";
> -  return llvm::createStringError(llvm::inconvertibleErrorCode(),
> - msg.GetString());
> -}
> -
> llvm::Expected>
> CommandObjectDisassemble::GetContainingAddressRanges() {
>   std::vector ranges;
> @@ -275,9 +254,6 @@ CommandObjectDisassemble::GetContainingAddressRanges() {
> "Could not find function bounds for address 0x%" PRIx64,
> m_options.symbol_containing_addr);
>   }
> -
> -  if (llvm::Error err = CheckRangeSize(ranges[0], "the function"))
> -return std::move(err);
>   return ranges;
> }
> 
> @@ -297,10 +273,8 @@ CommandObjectDisassemble::GetCurrentFunctionRanges() {
>   else if (sc.symbol && sc.symbol->ValueIsAddress()) {
> range = {sc.symbol->GetAddress(), sc.symbol->GetByteSize()};
>   } else
> -range = {frame->GetFrameCodeAddress(), default_disasm_byte_size};
> +range = {frame->GetFrameCodeAddress(), DEFAULT_DISASM_BYTE_SIZE};
> 
> -  if (llvm::Error err = CheckRangeSize(range, "the current function"))
> -return std::move(err);
>   return std::vector{range};
> }
> 
> @@ -324,7 +298,7 @@ CommandObjectDisassemble::GetCurrentLineRanges() {
> }
> 
> llvm::Expected>
> -CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
> +CommandObjectDisassemble::GetNameRanges() {
>   ConstString name(m_options.func_name.c_str());
>   const bool include_symbols = true;
>   const bool include_inlines = true;
> @@ -335,7 +309,6 @@ 
> CommandObjectDisassemble::GetNameRanges(CommandReturnObject &result) {
>   name, eFunctionNameTypeAuto, include_symbols, include_inlines, sc_list);
> 
>   std::vector ranges;
> -  llvm::Error range_errs = llvm::Error::success();
>   AddressRange range;
>   const uint32_t scope =
>   eSymbolContextBlock | eSymbolContextFunction | eSymbolContextSymbol;
> @@ -344,21 +317,14 @@ 
> CommandObjectDisa

[Lldb-commits] [PATCH] D79789: [lldb] Don't dissasemble large functions by default

2020-05-14 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

I reverted this it breaks `TestFoundationDisassembly.py`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79789



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


[Lldb-commits] [lldb] 9fde516 - [lldb/Test] Replace assertTrue with more specific checks (NFC)

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-05-14T15:48:48-07:00
New Revision: 9fde516032d71c325f156cb4b878cf6b12280de8

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

LOG: [lldb/Test] Replace assertTrue with more specific checks (NFC)

Use assertEqual(a, b) instead of assertTrue(a == b) etc.

Added: 


Modified: 
lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py 
b/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
index 2091987fd2f4..0491d1f10031 100644
--- a/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
+++ b/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
@@ -38,8 +38,8 @@ def check_category_breakpoints(self):
 lldb.eFunctionNameTypeSelector,
 lldb.SBFileSpecList(),
 lldb.SBFileSpecList())
-self.assertTrue(
-name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+self.assertEqual(
+name_bp.GetNumLocations(), selector_bp.GetNumLocations(),
 'Make sure setting a breakpoint by name "myCategoryFunction" sets 
a breakpoint even though it is in a category')
 for bp_loc in selector_bp:
 function_name = bp_loc.GetAddress().GetSymbol().GetName()
@@ -53,14 +53,14 @@ def check_category_breakpoints(self):
 "-[MyClass myCategoryFunction]")
 stripped2_bp = self.target.BreakpointCreateByName(
 "[MyClass myCategoryFunction]")
-self.assertTrue(
-category_bp.GetNumLocations() == 1,
+self.assertEqual(
+category_bp.GetNumLocations(), 1,
 "Make sure we can set a breakpoint using a full objective C 
function name with the category included (-[MyClass(MyCategory) 
myCategoryFunction])")
-self.assertTrue(
-stripped_bp.GetNumLocations() == 1,
+self.assertEqual(
+stripped_bp.GetNumLocations(), 1,
 "Make sure we can set a breakpoint using a full objective C 
function name without the category included (-[MyClass myCategoryFunction])")
-self.assertTrue(
-stripped2_bp.GetNumLocations() == 1,
+self.assertEqual(
+stripped2_bp.GetNumLocations(), 1,
 "Make sure we can set a breakpoint using a full objective C 
function name without the category included ([MyClass myCategoryFunction])")
 
 def check_objc_breakpoints(self, have_dsym):
@@ -86,11 +86,11 @@ def check_objc_breakpoints(self, have_dsym):
 lldb.eFunctionNameTypeSelector,
 lldb.SBFileSpecList(),
 lldb.SBFileSpecList())
-self.assertTrue(
-name_bp.GetNumLocations() >= selector_bp.GetNumLocations(),
+self.assertGreaterEqual(
+name_bp.GetNumLocations(), selector_bp.GetNumLocations(),
 'Make sure we get at least the same amount of breakpoints if not 
more when setting by name "count"')
-self.assertTrue(
-selector_bp.GetNumLocations() > 50,
+self.assertGreater(
+selector_bp.GetNumLocations(), 50,
 'Make sure we find a lot of "count" selectors')  # There are 93 on 
the latest MacOSX
 for bp_loc in selector_bp:
 function_name = bp_loc.GetAddress().GetSymbol().GetName()
@@ -109,8 +109,8 @@ def check_objc_breakpoints(self, have_dsym):
 lldb.eFunctionNameTypeSelector,
 lldb.SBFileSpecList(),
 lldb.SBFileSpecList())
-self.assertTrue(
-name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+self.assertEqual(
+name_bp.GetNumLocations(), selector_bp.GetNumLocations(),
 'Make sure setting a breakpoint by name "isEqual:" only sets 
selector breakpoints')
 for bp_loc in selector_bp:
 function_name = bp_loc.GetAddress().GetSymbol().GetName()
@@ -122,8 +122,8 @@ def check_objc_breakpoints(self, have_dsym):
 
 if have_dsym:
 shutil.rmtree(exe + ".dSYM")
-self.assertTrue(subprocess.call(
-['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded')
+self.assertEqual(subprocess.call(
+['/usr/bin/strip', '-Sx', exe]), 0, 'stripping dylib succeeded')
 
 # Check breakpoints again, this time using the symbol table only
 self.check_category_breakpoints()



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


[Lldb-commits] [PATCH] D79811: WIP: Reenable creation of artificial methods in AddMethodToCXXRecordType(...)

2020-05-14 Thread David Blaikie via Phabricator via lldb-commits
dblaikie added a comment.

In D79811#2036112 , @labath wrote:

> Here's another interesting use of aritificial functions: inherited 
> constructors.
>
>   struct A { A(int); };
>   struct B:A { using A::A; };
>   B b(2);
>
>
> The constructor B::B(int) will be marked artificial, but it is also not 
> reconstructible from the debug info because it use explicit default 
> initializers for all members in `B` (if they existed -- this example does not 
> have any).
>
> This example also demonstrates what I believe *is* a bug in the compiler. The 
> inherited constructor will get `DW_AT_name(A)`:
>
>   0x003f:   DW_TAG_structure_type
>   DW_AT_calling_convention(DW_CC_pass_by_value)
>   DW_AT_name  ("B")
>   DW_AT_byte_size (0x01)
>   DW_AT_decl_file ("/home/pavelo/ll/build/opt/")
>   DW_AT_decl_line (1)
>  
>   0x0048: DW_TAG_inheritance
> DW_AT_type(0x005f "A")
> DW_AT_data_member_location(0x00)
>  
>   0x004e: DW_TAG_subprogram
> DW_AT_name("A")
> DW_AT_declaration (true)
> DW_AT_artificial  (true)
> DW_AT_external(true)
>
>
> That doesn't sound correct to me. Gcc emits the name as `B`, which seems to 
> be much better. Looping in @dblaikie for thoughts.


Agreed - sounds like a bug/something to fix in Clang there - if you'd like to 
fix it/file a bug/etc.


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

https://reviews.llvm.org/D79811



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


[Lldb-commits] [lldb] bf02bcf - [lldb/Test] Modify more tests for API replay

2020-05-14 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-05-14T17:58:27-07:00
New Revision: bf02bcffcfd7dc965e930c6a3035895823d2d78b

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

LOG: [lldb/Test] Modify more tests for API replay

Skip tests or parts thereof that aren't expected to work when run from a
reproducer. Also improve the doc comments in configuration.py to prevent
mistakes in the future.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/test/API/commands/process/attach/attach_denied/TestAttachDenied.py

lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py

lldb/test/API/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/configuration.py 
b/lldb/packages/Python/lldbsuite/test/configuration.py
index 53f587b47db8..0439c4e8f1ac 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -163,6 +163,15 @@ def get_filecheck_path():
 
 def is_reproducer_replay():
 """
-Returns true when test is replayed from a reproducer.
+Returns true when dotest is being replayed from a reproducer. Never use
+this method to guard SB API calls as it will cause a divergence between
+capture and replay.
 """
 return replay_path is not None
+
+def is_reproducer():
+"""
+Returns true when dotest is capturing a reproducer or is being replayed
+from a reproducer. Use this method to guard SB API calls.
+"""
+return capture_path or replay_path

diff  --git 
a/lldb/test/API/commands/process/attach/attach_denied/TestAttachDenied.py 
b/lldb/test/API/commands/process/attach/attach_denied/TestAttachDenied.py
index dcd73da42e9e..a7565ccfeb75 100644
--- a/lldb/test/API/commands/process/attach/attach_denied/TestAttachDenied.py
+++ b/lldb/test/API/commands/process/attach/attach_denied/TestAttachDenied.py
@@ -21,6 +21,7 @@ class AttachDeniedTestCase(TestBase):
 @skipIfWindows
 @skipIfiOSSimulator
 @skipIfDarwinEmbedded  # ptrace(ATTACH_REQUEST...) won't work on 
ios/tvos/etc
+@skipIfReproducer
 def test_attach_to_process_by_id_denied(self):
 """Test attach by process id denied"""
 self.build()

diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
 
b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
index 956ec29809c8..f09839d62976 100644
--- 
a/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ 
b/lldb/test/API/commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -96,6 +96,7 @@ def test_watchpoint_command(self):
 substrs=['(int32_t)', 'cookie = 777'])
 
 @skipIfFreeBSD  # timing out on buildbot
+@skipIfReproducer
 def test_continue_in_watchpoint_command(self):
 """Test continue in a watchpoint command."""
 self.build(dictionary=self.d)

diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
index 40a20a04b76b..f9d5aeeeb3b2 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
@@ -13,6 +13,7 @@ class BreakpointSetRestart(TestBase):
 BREAKPOINT_TEXT = 'Set a breakpoint here'
 
 @skipIfNetBSD
+@skipIfReproducer
 def test_breakpoint_set_restart(self):
 self.build()
 

diff  --git 
a/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py 
b/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
index 0491d1f10031..4d1fe0e1036e 100644
--- a/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
+++ b/lldb/test/API/functionalities/breakpoint/objc/TestObjCBreakpoints.py
@@ -120,6 +120,10 @@ def check_objc_breakpoints(self, have_dsym):
 
 self.check_category_breakpoints()
 
+# Stop here for reproducers. They don't capture file system changes.
+if configuration.is_reproducer():
+return
+
 if have_dsym:
 shutil.rmtree(exe + ".dSYM")
 self.assertEqual(subprocess.call(



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


[Lldb-commits] [PATCH] D79726: Add terminateCommands to lldb-vscode protocol

2020-05-14 Thread António Afonso via Phabricator via lldb-commits
aadsm updated this revision to Diff 264143.
aadsm added a comment.

Updated README.md, package.json to document the new option. Also refactored the 
test support a bit to allow easier testing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79726

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
  lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
  lldb/tools/lldb-vscode/README.md
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json

Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -152,8 +152,13 @@
 			},
 			"exitCommands": {
 	"type": "array",
-	"description": "Commands executed at the end of debugging session.",
+	"description": "Commands executed when the program exits.",
 	"default": []
+			},
+			"terminateCommands": {
+"type": "array",
+"description": "Commands executed at the end of debugging session.",
+"default": []
 			}
 		}
 	},
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -174,6 +174,7 @@
 void SendTerminatedEvent() {
   if (!g_vsc.sent_terminated_event) {
 g_vsc.sent_terminated_event = true;
+g_vsc.RunTerminateCommands();
 // Send a "terminated" event
 llvm::json::Object event(CreateEventObject("terminated"));
 g_vsc.SendJSON(llvm::json::Value(std::move(event)));
@@ -529,6 +530,7 @@
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
+  g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands");
   auto attachCommands = GetStrings(arguments, "attachCommands");
   llvm::StringRef core_file = GetString(arguments, "coreFile");
   g_vsc.stop_at_entry =
@@ -772,7 +774,6 @@
   bool terminateDebuggee = GetBoolean(arguments, "terminateDebuggee", false);
   lldb::SBProcess process = g_vsc.target.GetProcess();
   auto state = process.GetState();
-
   switch (state) {
   case lldb::eStateInvalid:
   case lldb::eStateUnloaded:
@@ -1365,6 +1366,7 @@
   g_vsc.pre_run_commands = GetStrings(arguments, "preRunCommands");
   g_vsc.stop_commands = GetStrings(arguments, "stopCommands");
   g_vsc.exit_commands = GetStrings(arguments, "exitCommands");
+  g_vsc.terminate_commands = GetStrings(arguments, "terminateCommands");
   auto launchCommands = GetStrings(arguments, "launchCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
   const llvm::StringRef debuggerRoot = GetString(arguments, "debuggerRoot");
Index: lldb/tools/lldb-vscode/VSCode.h
===
--- lldb/tools/lldb-vscode/VSCode.h
+++ lldb/tools/lldb-vscode/VSCode.h
@@ -86,6 +86,7 @@
   std::vector pre_run_commands;
   std::vector exit_commands;
   std::vector stop_commands;
+  std::vector terminate_commands;
   lldb::tid_t focus_tid;
   bool sent_terminated_event;
   bool stop_at_entry;
@@ -132,6 +133,7 @@
   void RunPreRunCommands();
   void RunStopCommands();
   void RunExitCommands();
+  void RunTerminateCommands();
 
   /// Create a new SBTarget object from the given request arguments.
   /// \param[in] arguments
Index: lldb/tools/lldb-vscode/VSCode.cpp
===
--- lldb/tools/lldb-vscode/VSCode.cpp
+++ lldb/tools/lldb-vscode/VSCode.cpp
@@ -309,6 +309,10 @@
   RunLLDBCommands("Running exitCommands:", exit_commands);
 }
 
+void VSCode::RunTerminateCommands() {
+  RunLLDBCommands("Running terminateCommands:", terminate_commands);
+}
+
 lldb::SBTarget VSCode::CreateTargetFromArguments(
 const llvm::json::Object &arguments,
 lldb::SBError &error) {
Index: lldb/tools/lldb-vscode/README.md
===
--- lldb/tools/lldb-vscode/README.md
+++ lldb/tools/lldb-vscode/README.md
@@ -16,14 +16,14 @@
 
 The `lldb-vscode` tool creates a command line tool that implements the [Visual
 Studio Code Debug API](https://code.visualstudio.com/docs/extensionAPI/api-debugging).
-It can be installed as an extension for the Visual Studio Code and Nuclide IDE. 
+It can be installed as an extension for the Visual Studio Code and Nuclide IDE.
 The protocol is easy to run remotely and also can allow other tools and IDEs to
-get a full featured debugger with a well defined

[Lldb-commits] [PATCH] D79726: Add terminateCommands to lldb-vscode protocol

2020-05-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py:447
+]
+terminateCommands = ['expr 4+2']
+self.launch(program=program,

The expression parser can be quite involved even for simple things like this. 
Might be better to do something simpler?



Comment at: lldb/tools/lldb-vscode/README.md:88
 |**stopCommands**   |[string]| | LLDB commands executed just after each stop. 
Commands and command output will be sent to the debugger console when they are 
executed.
 |**exitCommands**   |[string]| | LLDB commands executed when the program 
exits. Commands and command output will be sent to the debugger console when 
they are executed.
+|**terminateCommands** |[string]| | LLDB commands executed when the debugging 
session ends. Commands and command output will be sent to the debugger console 
when they are executed.

Might be good to clarify something like:

```
These commands will only be executed if the process exists or is killed. These 
commands will not run if you disconnect from the process.
```



Comment at: lldb/tools/lldb-vscode/README.md:89
 |**exitCommands**   |[string]| | LLDB commands executed when the program 
exits. Commands and command output will be sent to the debugger console when 
they are executed.
+|**terminateCommands** |[string]| | LLDB commands executed when the debugging 
session ends. Commands and command output will be sent to the debugger console 
when they are executed.
 |**sourceMap**  |[string[2]]| | Specify an array of path re-mappings. Each 
element in the array must be a two element array containing a source and 
destination pathname.

might be good to clarify something like:

```
These commands will be executed after receiving the 'terminate' VS Code DAP 
packet but before sending the 'terminate' response.
```



Comment at: lldb/tools/lldb-vscode/README.md:115
 |**stopCommands**   |[string]| | LLDB commands executed just after each stop. 
Commands and command output will be sent to the debugger console when they are 
executed.
 |**exitCommands**   |[string]| | LLDB commands executed when the program 
exits. Commands and command output will be sent to the debugger console when 
they are executed.
+|**terminateCommands** |[string]| | LLDB commands executed when the debugging 
session ends. Commands and command output will be sent to the debugger console 
when they are executed.

Ditto on "exitCommands" clarification from above.



Comment at: lldb/tools/lldb-vscode/README.md:116
 |**exitCommands**   |[string]| | LLDB commands executed when the program 
exits. Commands and command output will be sent to the debugger console when 
they are executed.
+|**terminateCommands** |[string]| | LLDB commands executed when the debugging 
session ends. Commands and command output will be sent to the debugger console 
when they are executed.
 |**attachCommands** |[string]| | LLDB commands that will be executed after 
**preRunCommands** which take place of the code that normally does the attach. 
The commands can create a new target and attach or launch it however desired. 
This allows custom launch and attach configurations. Core files can use `target 
create --core /path/to/core` to attach to core files.

Ditto on "terminateCommands" clarification from above.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:2875
   lldb::SBDebugger::Terminate();
   return 0;
 }

You can't do this here the VS code connection will already be closed. We need 
the 'terminateCommands' output to be sent back to vs code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79726



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