[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

Can you check if we can remove this now?

I originally thought that we can remove this entire function, but I forgot 
about PUBLIC records -- we don't have functions or compile units for those, so 
they will have to stay.



Comment at: lldb/test/Shell/SymbolFile/Breakpad/line-table.test:45
 # CHECK-LABEL: breakpoint set -f c.c -l 2
-# CHECK: Breakpoint 1: where = line-table.out`func + 2, address = 
0x004000b2
+# CHECK: Breakpoint 1: where = line-table.out`func + 2 at c.c:2, address = 
0x004000b2

We should have a more explicit test for this. Some interesting things to check 
might be
- "image lookup -v" command should have a new `Function` entry in its output
- "image dump symfile" should contain some output about the functions that have 
been parsed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113165: [LIT] Add win32 PLATFORM env var to test config

2021-11-04 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo accepted this revision.
mstorsjo added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D113165

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


[Lldb-commits] [lldb] 531d877 - [lldb] Fix TestEchoCommands.test again

2021-11-04 Thread Lawrence D'Anna via lldb-commits

Author: Lawrence D'Anna
Date: 2021-11-04T01:24:25-07:00
New Revision: 531d877ee6410a94f5b4cb888d3c785d6ef0552c

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

LOG: [lldb] Fix TestEchoCommands.test again

In 7f01f78593d6 [lldb] update TestEchoCommands -- I fixed this test,
but not on windows, becuase I used  some unix shell syntax that
doesn't work with cmd.exe.   Fixed it so it will work in both.
Test logic is the same.

This is a trivial fix, so bypassing review to get the build clean again
ASAP.

Added: 


Modified: 
lldb/test/Shell/Settings/TestEchoCommands.test

Removed: 




diff  --git a/lldb/test/Shell/Settings/TestEchoCommands.test 
b/lldb/test/Shell/Settings/TestEchoCommands.test
index a667456303573..234b9742bfa2a 100644
--- a/lldb/test/Shell/Settings/TestEchoCommands.test
+++ b/lldb/test/Shell/Settings/TestEchoCommands.test
@@ -1,4 +1,8 @@
 # RUN: %lldb -x -b -o 'settings set interpreter.echo-comment-commands true'  
-s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsAll.out
 # RUN: %lldb -x -b -o 'settings set interpreter.echo-comment-commands false' 
-s %S/Inputs/EchoCommandsTest.in | FileCheck 
%S/Inputs/EchoCommandsNoComments.out
 # RUN: %lldb -x -b -o 'settings set interpreter.echo-commands false' 
-s %S/Inputs/EchoCommandsTest.in | FileCheck %S/Inputs/EchoCommandsNone.out
-# RUN: ( echo start ; %lldb -x -b --source-quietly -s 
%S/Inputs/EchoCommandsTest.in ; echo done ) | FileCheck  
%S/Inputs/EchoCommandsQuiet.out
+
+RUN: echo start >%t.file
+RUN: %lldb -x -b --source-quietly -s %S/Inputs/EchoCommandsTest.in >>%t.file
+RUN: echo done >>%t.file
+RUN: FileCheck  %S/Inputs/EchoCommandsQuiet.out <%t.file



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


[Lldb-commits] [PATCH] D113047: [lldb] update TestEchoCommands

2021-11-04 Thread Lawrence D'Anna via Phabricator via lldb-commits
lawrence_danna added a comment.

@stella.stamenova fixed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113047

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


[Lldb-commits] [PATCH] D104413: Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime.

2021-11-04 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!




Comment at: lldb/test/API/python_api/file_handle/TestFileHandle.py:920
+self.assertTrue(re.search(r'Show a list of all debugger commands', 
output))
+self.assertTrue(re.search(r'llvm revision', output))

Can you drop this line? Downstream tends to patch the version output with their 
own branding. Maybe `help command alias` and then check for `Define a custom 
command in terms of an existing command`.

Also I think you can use `self.assertIn('Show a list of all debugger commands', 
output)` here.


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

https://reviews.llvm.org/D104413

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


[Lldb-commits] [PATCH] D113174: [lldb] Summary provider for char flexible array members

2021-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: teemperor, shafik.
labath requested review of this revision.
Herald added a project: LLDB.

Add a summary provider which can print char[] members at the ends of
structs.

Depends on D112709 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113174

Files:
  lldb/source/DataFormatters/FormatManager.cpp
  
lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
  lldb/test/API/lang/c/flexible-array-members/Makefile
  lldb/test/API/lang/c/flexible-array-members/TestCFlexibleArrayMembers.py
  lldb/test/API/lang/c/flexible-array-members/main.c

Index: lldb/test/API/lang/c/flexible-array-members/main.c
===
--- /dev/null
+++ lldb/test/API/lang/c/flexible-array-members/main.c
@@ -0,0 +1,37 @@
+#include 
+#include 
+
+struct WithFlexChar {
+  int member;
+  char flexible[];
+};
+
+struct WithFlexSChar {
+  int member;
+  signed char flexible[];
+};
+
+struct WithFlexUChar {
+  int member;
+  unsigned char flexible[];
+};
+
+#define CONTENTS "contents"
+
+int main() {
+  struct WithFlexChar *c =
+  (struct WithFlexChar *)malloc(sizeof(int) + sizeof(CONTENTS));
+  c->member = 1;
+  strcpy(c->flexible, CONTENTS);
+
+  struct WithFlexSChar *sc =
+  (struct WithFlexSChar *)malloc(sizeof(int) + sizeof(CONTENTS));
+  sc->member = 1;
+  strcpy((char *)sc->flexible, CONTENTS);
+
+  struct WithFlexUChar *uc =
+  (struct WithFlexUChar *)malloc(sizeof(int) + sizeof(CONTENTS));
+  uc->member = 1;
+  strcpy((char *)uc->flexible, CONTENTS);
+  return 0; // break here
+}
Index: lldb/test/API/lang/c/flexible-array-members/TestCFlexibleArrayMembers.py
===
--- /dev/null
+++ lldb/test/API/lang/c/flexible-array-members/TestCFlexibleArrayMembers.py
@@ -0,0 +1,29 @@
+"""
+Tests C99's flexible array members.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+def test(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "// break here",
+lldb.SBFileSpec("main.c"))
+
+self.expect_var_path("c->flexible", type="char[]", summary='"contents"')
+self.expect_var_path("sc->flexible", type="signed char[]", summary='"contents"')
+self.expect_var_path("uc->flexible", type="unsigned char[]", summary='"contents"')
+# TODO: Make this work
+self.expect("expr c->flexible", error=True,
+substrs=["incomplete", "char[]"])
+self.expect("expr sc->flexible", error=True,
+substrs=["incomplete", "signed char[]"])
+self.expect("expr uc->flexible", error=True,
+substrs=["incomplete", "unsigned char[]"])
Index: lldb/test/API/lang/c/flexible-array-members/Makefile
===
--- /dev/null
+++ lldb/test/API/lang/c/flexible-array-members/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
Index: lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
===
--- lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
+++ lldb/test/API/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
@@ -25,8 +25,8 @@
 self.expect(
 'type summary list char',
 substrs=[
-'char *',
-'unsigned char'])
+'char ?(\*|\[\])',
+'char ?\[[0-9]+\]'])
 
 self.expect(
 'type summary list -w default',
@@ -40,5 +40,7 @@
 matching=False)
 self.expect(
 'type summary list -w system char',
-substrs=['unsigned char *'],
+substrs=[
+'char ?(\*|\[\])',
+'char ?\[[0-9]+\]'],
 matching=True)
Index: lldb/source/DataFormatters/FormatManager.cpp
===
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -729,12 +729,8 @@
   TypeCategoryImpl::SharedPointer sys_category_sp =
   GetCategory(m_system_category_name);
 
-  sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"),
-string_format);
-  sys_category_sp->GetTypeSummariesContainer()->Add(
-  ConstString("unsigned char *"), string_format);
-  sys_category_sp->GetTypeSummariesContainer()->Add(
-  ConstString("signed char *"), string_format);
+  sys_category_sp->GetRegexTypeSummariesContainer()->Add(
+  RegularE

[Lldb-commits] [PATCH] D113184: [lldb] Fix cross-platform kills

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

This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.

This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.

I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113184

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Target/Platform.cpp
  lldb/test/API/functionalities/gdb_remote_client/Makefile
  lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
  lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/test/API/functionalities/gdb_remote_client/sleep.cpp

Index: lldb/test/API/functionalities/gdb_remote_client/sleep.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/gdb_remote_client/sleep.cpp
@@ -0,0 +1,6 @@
+#include 
+
+int main() {
+  std::this_thread::sleep_for(std::chrono::minutes(1));
+  return 0;
+}
Index: lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
===
--- lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
+++ lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
@@ -203,6 +203,8 @@
 if packet.startswith("qRegisterInfo"):
 regnum = int(packet[len("qRegisterInfo"):], 16)
 return self.qRegisterInfo(regnum)
+if packet == "k":
+return self.k()
 
 return self.other(packet)
 
@@ -331,6 +333,9 @@
 def qRegisterInfo(self, num):
 return ""
 
+def k(self):
+return ""
+
 """
 Raised when we receive a packet for which there is no default action.
 Override the responder class to implement behavior suitable for the test at
Index: lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
===
--- /dev/null
+++ lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
@@ -0,0 +1,47 @@
+import lldb
+import time
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestPlatformKill(GDBRemoteTestBase):
+
+@skipIfRemote
+def test_kill_different_platform(self):
+"""Test connecting to a remote linux platform"""
+
+self.build(dictionary={"CXX_SOURCES":"sleep.cpp"})
+host_process = self.spawnSubprocess(self.getBuildArtifact())
+
+# Create a fake remote process with the same PID as host_process
+class MyResponder(MockGDBServerResponder):
+def __init__(self):
+MockGDBServerResponder.__init__(self)
+self.got_kill = False
+
+def qC(self):
+return "QC%x"%host_process.pid
+
+def k(self):
+self.got_kill = True
+return "X09"
+
+self.server.responder = MyResponder()
+
+error = lldb.SBError()
+target = self.dbg.CreateTarget("", "x86_64-pc-linux", "remote-linux",
+False, error)
+self.assertSuccess(error)
+process = self.connect(target)
+self.assertEqual(process.GetProcessID(), host_process.pid)
+
+host_platform = lldb.SBPlatform("host")
+self.assertSuccess(host_platform.Kill(host_process.pid))
+
+# Host dies, remote process lives.
+self.assertFalse(self.server.responder.got_kill)
+self.assertIsNotNone(host_process.wait(timeout=10))
+
+# Now kill the remote one as well
+self.assertSuccess(process.Kill())
+self.assertTrue(self.server.responder.got_kill)
Index: lldb/test/API/functionalities/gdb_remote_client/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/gdb_remote_client/Makefile
@@ -0,0 +1 @@
+include Makefile.rules
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1044,25 +1044,11 @@
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
   LLDB_LOGF(log, "Platform::%s, pid %" PRIu64,

[Lldb-commits] [lldb] cbd215d - [LIT] Add win32 PLATFORM env var to test config

2021-11-04 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2021-11-04T17:42:43+05:00
New Revision: cbd215dfe51df47e020c676a32c2672c573641a8

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

LOG: [LIT] Add win32 PLATFORM env var to test config

LIT skips various system environment variables while building test
config. It turns out that we require PLATFORM environment variable for
detection of x86 vs Arm windows platform.

This patch adds system environment variable PLATFORM into LIT test
config for detection of win32 Arm platform.

Reviewed By: mstorsjo

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

Added: 


Modified: 
lldb/test/Shell/helper/build.py
llvm/utils/lit/lit/llvm/config.py

Removed: 




diff  --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py
index 5689373d37a51..005f12bc09cf8 100755
--- a/lldb/test/Shell/helper/build.py
+++ b/lldb/test/Shell/helper/build.py
@@ -277,7 +277,10 @@ class MsvcBuilder(Builder):
 def __init__(self, toolchain_type, args):
 Builder.__init__(self, toolchain_type, args, '.obj')
 
-self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
+if os.getenv('PLATFORM') == 'arm64':
+self.msvc_arch_str = 'arm' if self.arch == '32' else 'arm64'
+else:
+self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
 
 if toolchain_type == 'msvc':
 # Make sure we're using the appropriate toolchain for the desired

diff  --git a/llvm/utils/lit/lit/llvm/config.py 
b/llvm/utils/lit/lit/llvm/config.py
index 7bc4b445b75e0..5231271f8fef9 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -38,7 +38,7 @@ def __init__(self, lit_config, config):
 # Many tools behave strangely if these environment variables aren't
 # set.
 self.with_system_environment(
-['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
+['SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'PLATFORM'])
 self.use_lit_shell = True
 
 global lit_path_displayed



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


[Lldb-commits] [lldb] b595137 - [LLDB] Fix Cpsr size for WoA64 target

2021-11-04 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2021-11-04T17:43:31+05:00
New Revision: b595137fe1c06c6fd72ad3c5b30a7750eeca07c1

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

LOG: [LLDB] Fix Cpsr size for WoA64 target

CPSR on Arm64 is 4 bytes in size but windows on Arm implementation is trying to 
read/write 8 bytes against a byte register causing LLDB unit tests failures.

Ref: 
https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-arm64_nt_context

Reviewed By: mstorsjo

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

Added: 


Modified: 

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp

lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
 
b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
index 1294928e09a5d..fc65945723218 100644
--- 
a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ 
b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -220,7 +220,7 @@ Status NativeRegisterContextWindows_arm64::GPRRead(const 
uint32_t reg,
 reg_value.SetUInt64(tls_context.Pc);
 break;
   case gpr_cpsr_arm64:
-reg_value.SetUInt64(tls_context.Cpsr);
+reg_value.SetUInt32(tls_context.Cpsr);
 break;
 
   case gpr_w0_arm64:
@@ -317,7 +317,7 @@ NativeRegisterContextWindows_arm64::GPRWrite(const uint32_t 
reg,
 tls_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr_arm64:
-tls_context.Cpsr = reg_value.GetAsUInt64();
+tls_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case gpr_w0_arm64:

diff  --git 
a/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
 
b/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
index 10bab7d37561d..3ce288597c86a 100644
--- 
a/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
+++ 
b/lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -171,7 +171,7 @@ bool RegisterContextWindows_arm64::ReadRegister(const 
RegisterInfo *reg_info,
 reg_value.SetUInt64(m_context.Pc);
 break;
   case gpr_cpsr:
-reg_value.SetUInt64(m_context.Cpsr);
+reg_value.SetUInt32(m_context.Cpsr);
 break;
 
   case gpr_w0:
@@ -385,7 +385,7 @@ bool RegisterContextWindows_arm64::WriteRegister(
 m_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr:
-m_context.Cpsr = reg_value.GetAsUInt64();
+m_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case fpu_v0:



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


[Lldb-commits] [PATCH] D113165: [LIT] Add win32 PLATFORM env var to test config

2021-11-04 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcbd215dfe51d: [LIT] Add win32 PLATFORM env var to test 
config (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113165

Files:
  lldb/test/Shell/helper/build.py
  llvm/utils/lit/lit/llvm/config.py


Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -38,7 +38,7 @@
 # Many tools behave strangely if these environment variables aren't
 # set.
 self.with_system_environment(
-['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
+['SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'PLATFORM'])
 self.use_lit_shell = True
 
 global lit_path_displayed
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -277,7 +277,10 @@
 def __init__(self, toolchain_type, args):
 Builder.__init__(self, toolchain_type, args, '.obj')
 
-self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
+if os.getenv('PLATFORM') == 'arm64':
+self.msvc_arch_str = 'arm' if self.arch == '32' else 'arm64'
+else:
+self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
 
 if toolchain_type == 'msvc':
 # Make sure we're using the appropriate toolchain for the desired


Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -38,7 +38,7 @@
 # Many tools behave strangely if these environment variables aren't
 # set.
 self.with_system_environment(
-['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
+['SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'PLATFORM'])
 self.use_lit_shell = True
 
 global lit_path_displayed
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -277,7 +277,10 @@
 def __init__(self, toolchain_type, args):
 Builder.__init__(self, toolchain_type, args, '.obj')
 
-self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
+if os.getenv('PLATFORM') == 'arm64':
+self.msvc_arch_str = 'arm' if self.arch == '32' else 'arm64'
+else:
+self.msvc_arch_str = 'x86' if self.arch == '32' else 'x64'
 
 if toolchain_type == 'msvc':
 # Make sure we're using the appropriate toolchain for the desired
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D112471: [LLDB] Fix Cpsr size for WoA64 target

2021-11-04 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb595137fe1c0: [LLDB] Fix Cpsr size for WoA64 target 
(authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112471

Files:
  
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
  
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp


Index: 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
===
--- 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
+++ 
lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -171,7 +171,7 @@
 reg_value.SetUInt64(m_context.Pc);
 break;
   case gpr_cpsr:
-reg_value.SetUInt64(m_context.Cpsr);
+reg_value.SetUInt32(m_context.Cpsr);
 break;
 
   case gpr_w0:
@@ -385,7 +385,7 @@
 m_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr:
-m_context.Cpsr = reg_value.GetAsUInt64();
+m_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case fpu_v0:
Index: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
===
--- 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -220,7 +220,7 @@
 reg_value.SetUInt64(tls_context.Pc);
 break;
   case gpr_cpsr_arm64:
-reg_value.SetUInt64(tls_context.Cpsr);
+reg_value.SetUInt32(tls_context.Cpsr);
 break;
 
   case gpr_w0_arm64:
@@ -317,7 +317,7 @@
 tls_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr_arm64:
-tls_context.Cpsr = reg_value.GetAsUInt64();
+tls_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case gpr_w0_arm64:


Index: lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/arm64/RegisterContextWindows_arm64.cpp
@@ -171,7 +171,7 @@
 reg_value.SetUInt64(m_context.Pc);
 break;
   case gpr_cpsr:
-reg_value.SetUInt64(m_context.Cpsr);
+reg_value.SetUInt32(m_context.Cpsr);
 break;
 
   case gpr_w0:
@@ -385,7 +385,7 @@
 m_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr:
-m_context.Cpsr = reg_value.GetAsUInt64();
+m_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case fpu_v0:
Index: lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
+++ lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp
@@ -220,7 +220,7 @@
 reg_value.SetUInt64(tls_context.Pc);
 break;
   case gpr_cpsr_arm64:
-reg_value.SetUInt64(tls_context.Cpsr);
+reg_value.SetUInt32(tls_context.Cpsr);
 break;
 
   case gpr_w0_arm64:
@@ -317,7 +317,7 @@
 tls_context.Pc = reg_value.GetAsUInt64();
 break;
   case gpr_cpsr_arm64:
-tls_context.Cpsr = reg_value.GetAsUInt64();
+tls_context.Cpsr = reg_value.GetAsUInt32();
 break;
 
   case gpr_w0_arm64:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] b738a69 - [lldb][NFC] StringRef-ify the name parameter in CreateEnumerationType

2021-11-04 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-11-04T14:49:16+01:00
New Revision: b738a69ab8e3da2d48fdf41aa1fa5a5673a7d3a1

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

LOG: [lldb][NFC] StringRef-ify the name parameter in CreateEnumerationType

Reviewed By: labath

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b6b99d2e9bcf6..4ac6e165dda37 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -843,7 +843,8 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext 
&sc,
 }
 
 clang_type = m_ast.CreateEnumerationType(
-attrs.name.GetCString(), GetClangDeclContextContainingDIE(die, 
nullptr),
+attrs.name.GetStringRef(),
+GetClangDeclContextContainingDIE(die, nullptr),
 GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
 attrs.is_scoped_enum);
   } else {

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 8856c7e72e08a..c29fc2230a674 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -1105,7 +1105,7 @@ clang::QualType 
PdbAstBuilder::CreateEnumType(PdbTypeSymId id,
 
   Declaration declaration;
   CompilerType enum_ct = m_clang.CreateEnumerationType(
-  uname.c_str(), decl_context, OptionalClangModuleID(), declaration,
+  uname, decl_context, OptionalClangModuleID(), declaration,
   ToCompilerType(underlying_type), er.isScoped());
 
   TypeSystemClang::StartTagDeclarationDefinition(enum_ct);

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 78a0d09a681ae..f45287fd0fff0 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -497,7 +497,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const 
PDBSymbol &type) {
   // Class). Set it false for now.
   bool isScoped = false;
 
-  ast_enum = m_ast.CreateEnumerationType(name.c_str(), decl_context,
+  ast_enum = m_ast.CreateEnumerationType(name, decl_context,
  OptionalClangModuleID(), decl,
  builtin_type, isScoped);
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 72b47d04b9c48..bb57d53426b54 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2288,7 +2288,7 @@ CompilerType 
TypeSystemClang::GetOrCreateStructForIdentifier(
 #pragma mark Enumeration Types
 
 CompilerType TypeSystemClang::CreateEnumerationType(
-const char *name, clang::DeclContext *decl_ctx,
+llvm::StringRef name, clang::DeclContext *decl_ctx,
 OptionalClangModuleID owning_module, const Declaration &decl,
 const CompilerType &integer_clang_type, bool is_scoped) {
   // TODO: Do something intelligent with the Declaration object passed in
@@ -2299,7 +2299,7 @@ CompilerType TypeSystemClang::CreateEnumerationType(
   //const bool IsFixed = false;
   EnumDecl *enum_decl = EnumDecl::CreateDeserialized(ast, 0);
   enum_decl->setDeclContext(decl_ctx);
-  if (name && name[0])
+  if (!name.empty())
 enum_decl->setDeclName(&ast.Idents.get(name));
   enum_decl->setScoped(is_scoped);
   enum_decl->setScopedUsingClassTag(is_scoped);

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index e542e6f5face2..e450b56ce7fb1 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -417,7 +417,7 @@ class TypeSystemClang : public TypeSystem {
size_t element_count, bool is_vector);
 
   // Enumeration Types
-  CompilerType CreateEnumerationType(const char *name,
+  CompilerType CreateEnumerationType(llvm::StringRef name,
  clang::DeclContext *decl_ctx,
  OptionalClangModuleID owning

[Lldb-commits] [PATCH] D113176: [lldb][NFC] StringRef-ify the name parameter in CreateEnumerationType

2021-11-04 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb738a69ab8e3: [lldb][NFC] StringRef-ify the name parameter 
in CreateEnumerationType (authored by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113176

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -417,7 +417,7 @@
size_t element_count, bool is_vector);
 
   // Enumeration Types
-  CompilerType CreateEnumerationType(const char *name,
+  CompilerType CreateEnumerationType(llvm::StringRef name,
  clang::DeclContext *decl_ctx,
  OptionalClangModuleID owning_module,
  const Declaration &decl,
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2288,7 +2288,7 @@
 #pragma mark Enumeration Types
 
 CompilerType TypeSystemClang::CreateEnumerationType(
-const char *name, clang::DeclContext *decl_ctx,
+llvm::StringRef name, clang::DeclContext *decl_ctx,
 OptionalClangModuleID owning_module, const Declaration &decl,
 const CompilerType &integer_clang_type, bool is_scoped) {
   // TODO: Do something intelligent with the Declaration object passed in
@@ -2299,7 +2299,7 @@
   //const bool IsFixed = false;
   EnumDecl *enum_decl = EnumDecl::CreateDeserialized(ast, 0);
   enum_decl->setDeclContext(decl_ctx);
-  if (name && name[0])
+  if (!name.empty())
 enum_decl->setDeclName(&ast.Idents.get(name));
   enum_decl->setScoped(is_scoped);
   enum_decl->setScopedUsingClassTag(is_scoped);
Index: lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -497,7 +497,7 @@
   // Class). Set it false for now.
   bool isScoped = false;
 
-  ast_enum = m_ast.CreateEnumerationType(name.c_str(), decl_context,
+  ast_enum = m_ast.CreateEnumerationType(name, decl_context,
  OptionalClangModuleID(), decl,
  builtin_type, isScoped);
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -1105,7 +1105,7 @@
 
   Declaration declaration;
   CompilerType enum_ct = m_clang.CreateEnumerationType(
-  uname.c_str(), decl_context, OptionalClangModuleID(), declaration,
+  uname, decl_context, OptionalClangModuleID(), declaration,
   ToCompilerType(underlying_type), er.isScoped());
 
   TypeSystemClang::StartTagDeclarationDefinition(enum_ct);
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -843,7 +843,8 @@
 }
 
 clang_type = m_ast.CreateEnumerationType(
-attrs.name.GetCString(), GetClangDeclContextContainingDIE(die, 
nullptr),
+attrs.name.GetStringRef(),
+GetClangDeclContextContainingDIE(die, nullptr),
 GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
 attrs.is_scoped_enum);
   } else {


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -417,7 +417,7 @@
size_t element_count, bool is_vector);
 
   // Enumeration Types
-  CompilerType CreateEnumerationType(const char *name,
+  CompilerType CreateEnumerationType(llvm::StringRef name,
  clang::DeclContext *decl_ctx,
  OptionalClangModuleID owning_module,
  const Declaration &decl,
Index: lldb/source/Plugins/Typ

[Lldb-commits] [lldb] 7323d07 - [lldb][NFC] Remove a bunch of unnecessary nullptr checks

2021-11-04 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-11-04T15:21:03+01:00
New Revision: 7323d07483f201b2d73009deef45d2eff4dcd856

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

LOG: [lldb][NFC] Remove a bunch of unnecessary nullptr checks

Those nullptr checks are after we already accessed the pointer.

Reviewed By: labath

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

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index bb57d53426b5..e9c45f12b842 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1327,19 +1327,16 @@ CompilerType TypeSystemClang::CreateRecordType(
   decl->setAnonymousStructOrUnion(true);
   }
 
-  if (decl) {
-if (metadata)
-  SetMetadata(decl, *metadata);
+  if (metadata)
+SetMetadata(decl, *metadata);
 
-if (access_type != eAccessNone)
-  decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
 
-if (decl_ctx)
-  decl_ctx->addDecl(decl);
+  if (decl_ctx)
+decl_ctx->addDecl(decl);
 
-return GetType(ast.getTagDeclType(decl));
-  }
-  return CompilerType();
+  return GetType(ast.getTagDeclType(decl));
 }
 
 namespace {
@@ -1605,15 +1602,13 @@ ClassTemplateDecl 
*TypeSystemClang::CreateClassTemplateDecl(
   template_cxx_decl->setDescribedClassTemplate(class_template_decl);
   SetOwningModule(class_template_decl, owning_module);
 
-  if (class_template_decl) {
-if (access_type != eAccessNone)
-  class_template_decl->setAccess(
-  ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+class_template_decl->setAccess(
+ConvertAccessTypeToAccessSpecifier(access_type));
 
-decl_ctx->addDecl(class_template_decl);
+  decl_ctx->addDecl(class_template_decl);
 
-VerifyDecl(class_template_decl);
-  }
+  VerifyDecl(class_template_decl);
 
   return class_template_decl;
 }
@@ -1803,7 +1798,7 @@ CompilerType TypeSystemClang::CreateObjCClass(
   decl->setImplicit(isInternal);
   SetOwningModule(decl, owning_module);
 
-  if (decl && metadata)
+  if (metadata)
 SetMetadata(decl, *metadata);
 
   return GetType(ast.getObjCInterfaceType(decl));
@@ -2141,8 +2136,7 @@ FunctionDecl *TypeSystemClang::CreateFunctionDeclaration(
   ? ConstexprSpecKind::Constexpr
   : ConstexprSpecKind::Unspecified);
   SetOwningModule(func_decl, owning_module);
-  if (func_decl)
-decl_ctx->addDecl(func_decl);
+  decl_ctx->addDecl(func_decl);
 
   VerifyDecl(func_decl);
 
@@ -2305,18 +2299,15 @@ CompilerType TypeSystemClang::CreateEnumerationType(
   enum_decl->setScopedUsingClassTag(is_scoped);
   enum_decl->setFixed(false);
   SetOwningModule(enum_decl, owning_module);
-  if (enum_decl) {
-if (decl_ctx)
-  decl_ctx->addDecl(enum_decl);
+  if (decl_ctx)
+decl_ctx->addDecl(enum_decl);
 
-// TODO: check if we should be setting the promotion type too?
-enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
+  // TODO: check if we should be setting the promotion type too?
+  enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
 
-enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
+  enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
 
-return GetType(ast.getTagDeclType(enum_decl));
-  }
-  return CompilerType();
+  return GetType(ast.getTagDeclType(enum_decl));
 }
 
 CompilerType TypeSystemClang::GetIntTypeFromBitSize(size_t bit_size,



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


[Lldb-commits] [PATCH] D113175: [lldb][NFC] Remove a bunch of unnecessary nullptr checks

2021-11-04 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7323d07483f2: [lldb][NFC] Remove a bunch of unnecessary 
nullptr checks (authored by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113175

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1327,19 +1327,16 @@
   decl->setAnonymousStructOrUnion(true);
   }
 
-  if (decl) {
-if (metadata)
-  SetMetadata(decl, *metadata);
+  if (metadata)
+SetMetadata(decl, *metadata);
 
-if (access_type != eAccessNone)
-  decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
 
-if (decl_ctx)
-  decl_ctx->addDecl(decl);
+  if (decl_ctx)
+decl_ctx->addDecl(decl);
 
-return GetType(ast.getTagDeclType(decl));
-  }
-  return CompilerType();
+  return GetType(ast.getTagDeclType(decl));
 }
 
 namespace {
@@ -1605,15 +1602,13 @@
   template_cxx_decl->setDescribedClassTemplate(class_template_decl);
   SetOwningModule(class_template_decl, owning_module);
 
-  if (class_template_decl) {
-if (access_type != eAccessNone)
-  class_template_decl->setAccess(
-  ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+class_template_decl->setAccess(
+ConvertAccessTypeToAccessSpecifier(access_type));
 
-decl_ctx->addDecl(class_template_decl);
+  decl_ctx->addDecl(class_template_decl);
 
-VerifyDecl(class_template_decl);
-  }
+  VerifyDecl(class_template_decl);
 
   return class_template_decl;
 }
@@ -1803,7 +1798,7 @@
   decl->setImplicit(isInternal);
   SetOwningModule(decl, owning_module);
 
-  if (decl && metadata)
+  if (metadata)
 SetMetadata(decl, *metadata);
 
   return GetType(ast.getObjCInterfaceType(decl));
@@ -2141,8 +2136,7 @@
   ? ConstexprSpecKind::Constexpr
   : ConstexprSpecKind::Unspecified);
   SetOwningModule(func_decl, owning_module);
-  if (func_decl)
-decl_ctx->addDecl(func_decl);
+  decl_ctx->addDecl(func_decl);
 
   VerifyDecl(func_decl);
 
@@ -2305,18 +2299,15 @@
   enum_decl->setScopedUsingClassTag(is_scoped);
   enum_decl->setFixed(false);
   SetOwningModule(enum_decl, owning_module);
-  if (enum_decl) {
-if (decl_ctx)
-  decl_ctx->addDecl(enum_decl);
+  if (decl_ctx)
+decl_ctx->addDecl(enum_decl);
 
-// TODO: check if we should be setting the promotion type too?
-enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
+  // TODO: check if we should be setting the promotion type too?
+  enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
 
-enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
+  enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
 
-return GetType(ast.getTagDeclType(enum_decl));
-  }
-  return CompilerType();
+  return GetType(ast.getTagDeclType(enum_decl));
 }
 
 CompilerType TypeSystemClang::GetIntTypeFromBitSize(size_t bit_size,


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1327,19 +1327,16 @@
   decl->setAnonymousStructOrUnion(true);
   }
 
-  if (decl) {
-if (metadata)
-  SetMetadata(decl, *metadata);
+  if (metadata)
+SetMetadata(decl, *metadata);
 
-if (access_type != eAccessNone)
-  decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
 
-if (decl_ctx)
-  decl_ctx->addDecl(decl);
+  if (decl_ctx)
+decl_ctx->addDecl(decl);
 
-return GetType(ast.getTagDeclType(decl));
-  }
-  return CompilerType();
+  return GetType(ast.getTagDeclType(decl));
 }
 
 namespace {
@@ -1605,15 +1602,13 @@
   template_cxx_decl->setDescribedClassTemplate(class_template_decl);
   SetOwningModule(class_template_decl, owning_module);
 
-  if (class_template_decl) {
-if (access_type != eAccessNone)
-  class_template_decl->setAccess(
-  ConvertAccessTypeToAccessSpecifier(access_type));
+  if (access_type != eAccessNone)
+class_template_decl->setAccess(
+ConvertAccessTypeToAccessSpecifier(access_type));
 
-decl_ctx->addDecl(class_template_decl);
+  decl_ctx->addDecl(class_template_decl);
 
-VerifyDecl(class_template_decl);
-  }
+  V

[Lldb-commits] [lldb] f6b7bcc - [lldb][NFC] StringRef-ify name param in CreateClassTemplateDecl

2021-11-04 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-11-04T15:28:02+01:00
New Revision: f6b7bcc64a6a3f4008839777f71d2f132f74ec85

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

LOG: [lldb][NFC] StringRef-ify name param in CreateClassTemplateDecl

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index e9c45f12b842..077104b8fe85 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1543,7 +1543,7 @@ static bool ClassTemplateAllowsToInstantiationArgs(
 
 ClassTemplateDecl *TypeSystemClang::CreateClassTemplateDecl(
 DeclContext *decl_ctx, OptionalClangModuleID owning_module,
-lldb::AccessType access_type, const char *class_name, int kind,
+lldb::AccessType access_type, llvm::StringRef class_name, int kind,
 const TemplateParameterInfos &template_param_infos) {
   ASTContext &ast = getASTContext();
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index e450b56ce7fb..f3a07397ec44 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -343,11 +343,10 @@ class TypeSystemClang : public TypeSystem {
   clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
   const TemplateParameterInfos &infos);
 
-  clang::ClassTemplateDecl *
-  CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
-  OptionalClangModuleID owning_module,
-  lldb::AccessType access_type, const char *class_name,
-  int kind, const TemplateParameterInfos &infos);
+  clang::ClassTemplateDecl *CreateClassTemplateDecl(
+  clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
+  lldb::AccessType access_type, llvm::StringRef class_name, int kind,
+  const TemplateParameterInfos &infos);
 
   clang::TemplateTemplateParmDecl *
   CreateTemplateTemplateParmDecl(const char *template_name);



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


[Lldb-commits] [PATCH] D100810: Use `GNUInstallDirs` to support custom installation dirs. -- LLVM

2021-11-04 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 added a comment.

@nib Sorry for not catching this myself. I must admit the error does confuse 
me. I have an macOS machine I can ssh to, and yes, if if you had some tips on 
how to reproduce there I would greatly appreciate them.

Thanks.




Comment at: llvm/docs/CMake.rst:270
+  Defaults to ``share/man``.
+
 .. _LLVM-related variables:

compnerd wrote:
> I'm kinda torn on this.  The variables here are all CMake standard and we 
> should redirect users to CMake.  Although, this is following the existing 
> pattern, so seems reasonable.
Yeah maybe we can redo the section after. "rarely used" is a funny title; 
shouldn't we be mentioning he most notable CMake variables if any at all?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100810

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


[Lldb-commits] [PATCH] D113186: [NFC] Inclusive language: Remove instances of master in URLs

2021-11-04 Thread Quinn Pham via Phabricator via lldb-commits
quinnp created this revision.
Herald added subscribers: wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, 
teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, 
Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, 
shauheen, rriddle, mehdi_amini, usaxena95, kadircet, arphaman, hiraditya, 
jgravelle-google, arichardson, sbc100, mgorny, dschuff.
Herald added a reviewer: MaskRay.
Herald added a reviewer: ftynse.
quinnp requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, libcxx-commits, 
lldb-commits, stephenneuendorffer, nicolasvasilache, aheejin.
Herald added projects: clang, LLDB, libc++, MLIR, LLVM, clang-tools-extra.
Herald added a reviewer: libc++.

[NFC] This patch fixes URLs containing "master". Old URLs were either broken or
redirecting to the new URL.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113186

Files:
  clang-tools-extra/clangd/Protocol.h
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/LibFormat.rst
  clang/docs/UsersManual.rst
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/Format/Format.cpp
  clang/lib/Format/FormatToken.h
  clang/lib/Format/TokenAnnotator.cpp
  clang/test/OpenMP/aarch64_vfabi_NarrowestDataSize.c
  clang/test/OpenMP/aarch64_vfabi_WidestDataSize.c
  clang/www/related.html
  libcxx/utils/ci/Dockerfile
  lld/docs/WebAssembly.rst
  lld/wasm/Driver.cpp
  lld/wasm/SyntheticSections.h
  lldb/unittests/Process/minidump/Inputs/linux-x86_64.cpp
  llvm/CMakeLists.txt
  llvm/docs/CompileCudaWithLLVM.rst
  llvm/docs/Proposals/TestSuite.rst
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/Target/WebAssembly/README.txt
  llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp
  llvm/utils/gn/README.rst
  mlir/docs/Dialects/SPIR-V.md
  mlir/docs/LangRef.md
  mlir/docs/Rationale/Rationale.md
  mlir/docs/Rationale/RationaleGenericDAGRewriter.md
  mlir/include/mlir/Dialect/LLVMIR/ROCDLDialect.h
  mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
  utils/bazel/.bazelrc
  utils/bazel/README.md

Index: utils/bazel/README.md
===
--- utils/bazel/README.md
+++ utils/bazel/README.md
@@ -28,7 +28,7 @@
you don't have a checkout yet.
 2. Install Bazel at the version indicated by [.bazelversion](./.bazelversion),
following the official instructions, if you don't have it installed yet:
-   https://docs.bazel.build/versions/master/install.html.
+   https://docs.bazel.build/versions/main/install.html.
 3. `cd utils/bazel`
 4. `bazel build --config=generic_clang @llvm-project//...` (if building on Unix
with Clang). `--config=generic_gcc` and `--config=msvc` are also available.
@@ -45,7 +45,7 @@
 ```
 
 You can enable
-[disk caching](https://docs.bazel.build/versions/master/remote-caching.html#disk-cache),
+[disk caching](https://docs.bazel.build/versions/main/remote-caching.html#disk-cache),
 which will cache build results
 
 ```.bazelrc
@@ -53,7 +53,7 @@
 ```
 
 You can instruct Bazel to use a ramdisk for its sandboxing operations via
-[--sandbox_base](https://docs.bazel.build/versions/master/command-line-reference.html#flag--sandbox_base),
+[--sandbox_base](https://docs.bazel.build/versions/main/command-line-reference.html#flag--sandbox_base),
 which can help avoid IO bottlenecks for the symlink stragegy used for
 sandboxing. This is especially important with many inputs and many cores (see
 https://github.com/bazelbuild/bazel/issues/11868):
Index: utils/bazel/.bazelrc
===
--- utils/bazel/.bazelrc
+++ utils/bazel/.bazelrc
@@ -158,7 +158,7 @@
 # Platform flags:
 # The toolchain container used for execution is defined in the target indicated
 # by "extra_execution_platforms", "host_platform" and "platforms".
-# More about platforms: https://docs.bazel.build/versions/master/platforms.html
+# More about platforms: https://docs.bazel.build/versions/main/platforms.html
 build:rbe --extra_toolchains=@rbe_default//config:cc-toolchain
 build:rbe --extra_execution_platforms=@rbe_default//config:platform
 build:rbe --host_platform=@rbe_default//config:platform
Index: mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
===
--- mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
+++ mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.h
@@ -7,7 +7,7 @@
 //===--===//
 //
 // This file contains structs based on the LSP specification at
-// https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md
+// https://github.com/Microsoft/language-server-protocol/blob/main/protocol.md
 //
 // This is not meant to be a complete implementation, new interfaces are added
 // when they're needed.
Index: mlir/include/mlir/Dialect/LLVMIR/ROCDLDialect.h
==

[Lldb-commits] [PATCH] D113184: [lldb] Fix cross-platform kills

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

LGTM




Comment at: 
lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py:17-27
+class MyResponder(MockGDBServerResponder):
+def __init__(self):
+MockGDBServerResponder.__init__(self)
+self.got_kill = False
+
+def qC(self):
+return "QC%x"%host_process.pid

I always appreciate the elegance of these tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113184

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


[Lldb-commits] [lldb] 3120cad - [debugserver] Fix typo in DNBArchImplARM64

2021-11-04 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-11-04T09:43:50-07:00
New Revision: 3120cadac782cd51f88f52dd2e88a20a6aa77b4b

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

LOG: [debugserver] Fix typo in DNBArchImplARM64

rdar://85020754

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp 
b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
index 305eb14de533..e065718c7df9 100644
--- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
@@ -159,7 +159,7 @@ kern_return_t DNBArchMachARM64::GetGPRState(bool force) {
 uint64_t log_fp = m_state.context.gpr.__fp;
 uint64_t log_lr = m_state.context.gpr.__lr;
 uint64_t log_sp = m_state.context.gpr.__sp;
-uint64_t log_pc = m_state.context.gpr.__pc,
+uint64_t log_pc = m_state.context.gpr.__pc;
 #endif
 DNBLogThreaded(
 "thread_get_state(0x%4.4x, %u, &gpr, %u) => 0x%8.8x (count = %u) regs"



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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 384815.
zequanwu marked an inline comment as done.
zequanwu added a comment.

Add tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

Files:
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/test/Shell/SymbolFile/Breakpad/line-table.test
  lldb/test/Shell/SymbolFile/Breakpad/symtab.test

Index: lldb/test/Shell/SymbolFile/Breakpad/symtab.test
===
--- lldb/test/Shell/SymbolFile/Breakpad/symtab.test
+++ lldb/test/Shell/SymbolFile/Breakpad/symtab.test
@@ -13,6 +13,7 @@
 
 # CHECK-LABEL: (lldb) image lookup -a 0x4000b0 -v
 # CHECK: Address: symtab.out[0x004000b0] (symtab.out.PT_LOAD[0]..text2 + 0)
+# CHECK: Function: id = {0x0001}, name = "f1_func", range = [0x004000b0-0x004000bc)
 # CHECK: Symbol: id = {0x}, range = [0x004000b0-0x004000bc), name="f1_func"
 
 # CHECK-LABEL: (lldb) image lookup -n f2 -v
Index: lldb/test/Shell/SymbolFile/Breakpad/line-table.test
===
--- lldb/test/Shell/SymbolFile/Breakpad/line-table.test
+++ lldb/test/Shell/SymbolFile/Breakpad/line-table.test
@@ -39,7 +39,16 @@
 image lookup -a 0x4000b2 -v
 # CHECK-LABEL: image lookup -a 0x4000b2 -v
 # CHECK: Summary: line-table.out`func + 2
+# CHECK: Function: id = {0x}, name = "func", range = [0x004000b0-0x004000c0)
+
+image dump symfile
+# CHECK-LABEL: Compile units:
+# CHECK-NEXT:  CompileUnit{0x}, language = "", file = '/tmp/a.c'
+# CHECK-NEXT:   Function{0x}, demangled = func, type_uid = 0x
+# CHECK:  CompileUnit{0x0001}, language = "", file = '/tmp/c.c'
+# CHECK-NEXT:  CompileUnit{0x0002}, language = "", file = '/tmp/d.c'
+# CHECK-NEXT:  CompileUnit{0x0003}, language = "", file = '/tmp/d.c'
 
 breakpoint set -f c.c -l 2
 # CHECK-LABEL: breakpoint set -f c.c -l 2
-# CHECK: Breakpoint 1: where = line-table.out`func + 2, address = 0x004000b2
+# CHECK: Breakpoint 1: where = line-table.out`func + 2 at c.c:2, address = 0x004000b2
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
===
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -63,6 +63,8 @@
 return lldb::eLanguageTypeUnknown;
   }
 
+  lldb::FunctionSP GetOrCreateFunction(CompileUnit &comp_unit);
+
   size_t ParseFunctions(CompileUnit &comp_unit) override;
 
   bool ParseLineTable(CompileUnit &comp_unit) override;
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -219,9 +219,40 @@
   return cu_sp;
 }
 
+FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) {
+  user_id_t id = comp_unit.GetID();
+  if (FunctionSP func_sp = comp_unit.FindFunctionByUID(id))
+return func_sp;
+
+  Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS);
+  FunctionSP func_sp;
+  addr_t base = GetBaseFileAddress();
+  if (base == LLDB_INVALID_ADDRESS) {
+LLDB_LOG(log, "Unable to fetch the base address of object file. Skipping "
+  "symtab population.");
+return func_sp;
+  }
+
+  const SectionList *list = comp_unit.GetModule()->GetSectionList();
+  CompUnitData &data = m_cu_data->GetEntryRef(id).data;
+  LineIterator It(*m_objfile_sp, Record::Func, data.bookmark);
+  assert(Record::classify(*It) == Record::Func);
+
+  if (auto record = FuncRecord::parse(*It)) {
+addr_t address = record->Address + base;
+SectionSP section_sp = list->FindSectionContainingFileAddress(address);
+AddressRange func_range(section_sp, address - section_sp->GetFileAddress(),
+record->Size);
+func_sp = std::make_shared(
+&comp_unit, id, 0, Mangled(record->Name), nullptr, func_range);
+comp_unit.AddFunction(func_sp);
+  }
+  return func_sp;
+}
+
 size_t SymbolFileBreakpad::ParseFunctions(CompileUnit &comp_unit) {
-  // TODO
-  return 0;
+  std::lock_guard guard(GetModuleMutex());
+  return GetOrCreateFunction(comp_unit) ? 1 : 0;
 }
 
 bool SymbolFileBreakpad::ParseLineTable(CompileUnit &comp_unit) {
@@ -251,7 +282,8 @@
  SymbolContextItem resolve_scope,
  SymbolContext &sc) {
   std::lock_guard guard(GetModuleMutex());
-  if (!(resolve_scope & (eSymbolContextCompUnit | eSymbolContextLineEntry)))
+  if (!(resolve_scope & (eSymbolContextCompUnit | eSymbolContextLineEntry |
+ eSymbo

[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

labath wrote:
> Can you check if we can remove this now?
> 
> I originally thought that we can remove this entire function, but I forgot 
> about PUBLIC records -- we don't have functions or compile units for those, 
> so they will have to stay.
Removing it causes FUNC records not showing up in symtab when doing `image dump 
symtab ...` and fails some tests.
The Breakpad doc says 
(https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):

> If a given address is covered by both a PUBLIC record and a FUNC record, the 
> processor uses the FUNC data.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113174: [lldb] Summary provider for char flexible array members

2021-11-04 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Regex Type summary matching happens after all the ConstString format matching.  
Enrico did it that way because the ConstString matching is so much quicker, so 
if we can find a match there we'll get to it more quickly...

So this patch moves the char * recognition from the beginning of the type 
summary matching to the end, and potentially makes it a slower match.

I doubt that this will be noticeable on modern systems, however, just something 
to keep in mind.

It also changes the order of search slightly.  I think this is observable: it 
would mean a regex that happens to match "char *" as well as other things used 
to not be chosen for "char *" because it would have hit the ConstString summary 
first.  Now it will match, because the built-in regex summary will be checked 
after the user added ones.

Again, I don't think this is a reason not to do the patch.  But something to 
keep in mind.  The code itself looks fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113174

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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

zequanwu wrote:
> labath wrote:
> > Can you check if we can remove this now?
> > 
> > I originally thought that we can remove this entire function, but I forgot 
> > about PUBLIC records -- we don't have functions or compile units for those, 
> > so they will have to stay.
> Removing it causes FUNC records not showing up in symtab when doing `image 
> dump symtab ...` and fails some tests.
> The Breakpad doc says 
> (https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):
> 
> > If a given address is covered by both a PUBLIC record and a FUNC record, 
> > the processor uses the FUNC data.
> 
It's expected that the tests verifying symtab contents need updating after you 
remove some things from it. It's also possible some other tests will need minor 
tweaks (like the one in `line-table.test:54`) because of small differences in 
output format.

Whether this is a reasonable change cannot be judged by failing tests alone. 
You also need to evaluate the overall quality of the debugger output. That will 
have to be a judgement call, but I'm hoping it won't be a hard one. For 
example, the change in line-table.test was definitely for the better.

>> If a given address is covered by both a PUBLIC record and a FUNC record, the 
>> processor uses the FUNC data.

And if an address is covered both by a Symtab Symbol, and an SymbolFile 
Function, lldb will preferentially (in backtraces, for instance) display 
information from the Function, so I think (hope) that this is going to work 
exactly as desired.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

labath wrote:
> zequanwu wrote:
> > labath wrote:
> > > Can you check if we can remove this now?
> > > 
> > > I originally thought that we can remove this entire function, but I 
> > > forgot about PUBLIC records -- we don't have functions or compile units 
> > > for those, so they will have to stay.
> > Removing it causes FUNC records not showing up in symtab when doing `image 
> > dump symtab ...` and fails some tests.
> > The Breakpad doc says 
> > (https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):
> > 
> > > If a given address is covered by both a PUBLIC record and a FUNC record, 
> > > the processor uses the FUNC data.
> > 
> It's expected that the tests verifying symtab contents need updating after 
> you remove some things from it. It's also possible some other tests will need 
> minor tweaks (like the one in `line-table.test:54`) because of small 
> differences in output format.
> 
> Whether this is a reasonable change cannot be judged by failing tests alone. 
> You also need to evaluate the overall quality of the debugger output. That 
> will have to be a judgement call, but I'm hoping it won't be a hard one. For 
> example, the change in line-table.test was definitely for the better.
> 
> >> If a given address is covered by both a PUBLIC record and a FUNC record, 
> >> the processor uses the FUNC data.
> 
> And if an address is covered both by a Symtab Symbol, and an SymbolFile 
> Function, lldb will preferentially (in backtraces, for instance) display 
> information from the Function, so I think (hope) that this is going to work 
> exactly as desired.
These two commands `image lookup -n ...` and `image show-unwind -n ..` also 
failed to give any information if the name is from FUNC records.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

zequanwu wrote:
> labath wrote:
> > zequanwu wrote:
> > > labath wrote:
> > > > Can you check if we can remove this now?
> > > > 
> > > > I originally thought that we can remove this entire function, but I 
> > > > forgot about PUBLIC records -- we don't have functions or compile units 
> > > > for those, so they will have to stay.
> > > Removing it causes FUNC records not showing up in symtab when doing 
> > > `image dump symtab ...` and fails some tests.
> > > The Breakpad doc says 
> > > (https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):
> > > 
> > > > If a given address is covered by both a PUBLIC record and a FUNC 
> > > > record, the processor uses the FUNC data.
> > > 
> > It's expected that the tests verifying symtab contents need updating after 
> > you remove some things from it. It's also possible some other tests will 
> > need minor tweaks (like the one in `line-table.test:54`) because of small 
> > differences in output format.
> > 
> > Whether this is a reasonable change cannot be judged by failing tests 
> > alone. You also need to evaluate the overall quality of the debugger 
> > output. That will have to be a judgement call, but I'm hoping it won't be a 
> > hard one. For example, the change in line-table.test was definitely for the 
> > better.
> > 
> > >> If a given address is covered by both a PUBLIC record and a FUNC record, 
> > >> the processor uses the FUNC data.
> > 
> > And if an address is covered both by a Symtab Symbol, and an SymbolFile 
> > Function, lldb will preferentially (in backtraces, for instance) display 
> > information from the Function, so I think (hope) that this is going to work 
> > exactly as desired.
> These two commands `image lookup -n ...` and `image show-unwind -n ..` also 
> failed to give any information if the name is from FUNC records.
Oh, maybe those commands use `FindFunctions` to lookup for function by name?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

zequanwu wrote:
> zequanwu wrote:
> > labath wrote:
> > > zequanwu wrote:
> > > > labath wrote:
> > > > > Can you check if we can remove this now?
> > > > > 
> > > > > I originally thought that we can remove this entire function, but I 
> > > > > forgot about PUBLIC records -- we don't have functions or compile 
> > > > > units for those, so they will have to stay.
> > > > Removing it causes FUNC records not showing up in symtab when doing 
> > > > `image dump symtab ...` and fails some tests.
> > > > The Breakpad doc says 
> > > > (https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):
> > > > 
> > > > > If a given address is covered by both a PUBLIC record and a FUNC 
> > > > > record, the processor uses the FUNC data.
> > > > 
> > > It's expected that the tests verifying symtab contents need updating 
> > > after you remove some things from it. It's also possible some other tests 
> > > will need minor tweaks (like the one in `line-table.test:54`) because of 
> > > small differences in output format.
> > > 
> > > Whether this is a reasonable change cannot be judged by failing tests 
> > > alone. You also need to evaluate the overall quality of the debugger 
> > > output. That will have to be a judgement call, but I'm hoping it won't be 
> > > a hard one. For example, the change in line-table.test was definitely for 
> > > the better.
> > > 
> > > >> If a given address is covered by both a PUBLIC record and a FUNC 
> > > >> record, the processor uses the FUNC data.
> > > 
> > > And if an address is covered both by a Symtab Symbol, and an SymbolFile 
> > > Function, lldb will preferentially (in backtraces, for instance) display 
> > > information from the Function, so I think (hope) that this is going to 
> > > work exactly as desired.
> > These two commands `image lookup -n ...` and `image show-unwind -n ..` also 
> > failed to give any information if the name is from FUNC records.
> Oh, maybe those commands use `FindFunctions` to lookup for function by name?
Yes, that will most likely be it.

If implementing FindFunctions ends up being non-trivial, we can do that (along 
with the symtab removal) in a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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


[Lldb-commits] [PATCH] D113163: [LLDB][Breakpad] Create a function for each compilation unit.

2021-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added inline comments.



Comment at: 
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp:388-392
   for (llvm::StringRef line : lines(Record::Func)) {
 if (auto record = FuncRecord::parse(line))
   add_symbol(record->Address, record->Size, record->Name);
   }
 

labath wrote:
> zequanwu wrote:
> > zequanwu wrote:
> > > labath wrote:
> > > > zequanwu wrote:
> > > > > labath wrote:
> > > > > > Can you check if we can remove this now?
> > > > > > 
> > > > > > I originally thought that we can remove this entire function, but I 
> > > > > > forgot about PUBLIC records -- we don't have functions or compile 
> > > > > > units for those, so they will have to stay.
> > > > > Removing it causes FUNC records not showing up in symtab when doing 
> > > > > `image dump symtab ...` and fails some tests.
> > > > > The Breakpad doc says 
> > > > > (https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/symbol_files.md#records-4):
> > > > > 
> > > > > > If a given address is covered by both a PUBLIC record and a FUNC 
> > > > > > record, the processor uses the FUNC data.
> > > > > 
> > > > It's expected that the tests verifying symtab contents need updating 
> > > > after you remove some things from it. It's also possible some other 
> > > > tests will need minor tweaks (like the one in `line-table.test:54`) 
> > > > because of small differences in output format.
> > > > 
> > > > Whether this is a reasonable change cannot be judged by failing tests 
> > > > alone. You also need to evaluate the overall quality of the debugger 
> > > > output. That will have to be a judgement call, but I'm hoping it won't 
> > > > be a hard one. For example, the change in line-table.test was 
> > > > definitely for the better.
> > > > 
> > > > >> If a given address is covered by both a PUBLIC record and a FUNC 
> > > > >> record, the processor uses the FUNC data.
> > > > 
> > > > And if an address is covered both by a Symtab Symbol, and an SymbolFile 
> > > > Function, lldb will preferentially (in backtraces, for instance) 
> > > > display information from the Function, so I think (hope) that this is 
> > > > going to work exactly as desired.
> > > These two commands `image lookup -n ...` and `image show-unwind -n ..` 
> > > also failed to give any information if the name is from FUNC records.
> > Oh, maybe those commands use `FindFunctions` to lookup for function by name?
> Yes, that will most likely be it.
> 
> If implementing FindFunctions ends up being non-trivial, we can do that 
> (along with the symtab removal) in a separate patch.
After implementing `FindFunctions` and removing this, `image lookup -a 0x4000b0 
-v` in (lldb/test/Shell/SymbolFile/Breakpad/symtab.test) shows:
```
Function: id = {0x0001}, name = "f1_func", range = 
[0x004000b0-0x004000bc)
   Symbol: id = {0x}, range = 
[0x004000b0-0x004000c0), name="f1"
```
The symbol name is different from function because symbol name is from symtab 
and function name is from function in CU.

And `image lookup -n f1` and `image lookup -n f1_func` both give:
```
Address: symtab.out[0x004000b0] (symtab.out.PT_LOAD[0]..text2 + 
0)
Summary: symtab.out`f1_func
```

Looks like we don't want to remove this part.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113163

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