[Lldb-commits] [PATCH] D137466: [lldb/crashlog] Fix frame parser regex for when there is no source info

2022-11-04 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3e8c1c4fc48a: [lldb/crashlog] Fix frame parser regex for 
when there is no source info (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137466

Files:
  lldb/examples/python/crashlog.py
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
===
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out  @foo@ foo + 16 (test.c:3)
-1   a.out  @bar@ bar + 9 (test.c:6)
+1   a.out  @bar@
 2   a.out  @main@ main + 20 (test.c:8)
 3   libdyld.dylib  0x100 start + 1
 
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@
  r'(.+?)\s+'   # img_name
  r'(?:' +version+ r'\s+)?' # img_version
  r'(0x[0-9a-fA-F]{4,})'# addr (4 chars or more)
- r' +(.*)' # offs
+ r'(?: +(.*))?'# offs
 )
 null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
 image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'  # img_lo


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
===
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out 	@foo@ foo + 16 (test.c:3)
-1   a.out 	@bar@ bar + 9 (test.c:6)
+1   a.out 	@bar@
 2   a.out 	@main@ main + 20 (test.c:8)
 3   libdyld.dylib 	0x100 start + 1
 
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@
  r'(.+?)\s+'   # img_name
  r'(?:' +version+ r'\s+)?' # img_version
  r'(0x[0-9a-fA-F]{4,})'# addr (4 chars or more)
- r' +(.*)' # offs
+ r'(?: +(.*))?'# offs
 )
 null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
 image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'  # img_lo
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] acba66f - [lldb/crashlog] Standardize file path key in the ScriptedProcess Dictionary

2022-11-04 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-04T22:05:58-07:00
New Revision: acba66fdde0ea918d4b7bd16863ac1bba7d1521b

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

LOG: [lldb/crashlog] Standardize file path key in the ScriptedProcess Dictionary

This patch replaces the backing file path key to "file_path" to keep it
consistent.

rdar://101652618

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py
lldb/examples/python/scripted_process/crashlog_scripted_process.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index c3a450ccb14bd..b62ebd758f22c 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1104,7 +1104,7 @@ def load_crashlog_in_scripted_process(debugger, 
crash_log_file, options, result)
 raise InteractiveCrashLogException("couldn't import crashlog scripted 
process module")
 
 structured_data = lldb.SBStructuredData()
-structured_data.SetFromJSON(json.dumps({ "crashlog_path" : crashlog_path,
+structured_data.SetFromJSON(json.dumps({ "file_path" : crashlog_path,
  "load_all_images": 
options.load_all_images }))
 launch_info = lldb.SBLaunchInfo(None)
 launch_info.SetProcessPluginName("ScriptedProcess")

diff  --git 
a/lldb/examples/python/scripted_process/crashlog_scripted_process.py 
b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index 55c50917c9d67..7ed5cc930da72 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -71,7 +71,7 @@ def __init__(self, target: lldb.SBTarget, args : 
lldb.SBStructuredData):
 
 self.crashlog_path = None
 
-crashlog_path = args.GetValueForKey("crashlog_path")
+crashlog_path = args.GetValueForKey("file_path")
 if crashlog_path and crashlog_path.IsValid():
 if crashlog_path.GetType() == lldb.eStructuredDataTypeString:
 self.crashlog_path = crashlog_path.GetStringValue(4096)



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


[Lldb-commits] [lldb] 40afc69 - [lldb/test] Fix StructuredDataTest::GetDescriptionEmpty warning (NFC)

2022-11-04 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-04T22:05:58-07:00
New Revision: 40afc69e6dc0cc39e9e090ed96df95d6334db17c

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

LOG: [lldb/test] Fix StructuredDataTest::GetDescriptionEmpty warning (NFC)

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/unittests/Utility/StructuredDataTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/StructuredDataTest.cpp 
b/lldb/unittests/Utility/StructuredDataTest.cpp
index e732016fe43db..e536039f365a4 100644
--- a/lldb/unittests/Utility/StructuredDataTest.cpp
+++ b/lldb/unittests/Utility/StructuredDataTest.cpp
@@ -38,7 +38,7 @@ TEST(StructuredDataTest, GetDescriptionEmpty) {
 
   StreamString S;
   object_sp->GetDescription(S);
-  EXPECT_EQ(0, S.GetSize());
+  EXPECT_EQ(0u, S.GetSize());
 }
 
 TEST(StructuredDataTest, GetDescriptionBasic) {



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


[Lldb-commits] [lldb] 3e8c1c4 - [lldb/crashlog] Fix frame parser regex for when there is no source info

2022-11-04 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-04T22:05:58-07:00
New Revision: 3e8c1c4fc48a286dd546899a7374dce680633d93

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

LOG: [lldb/crashlog] Fix frame parser regex for when there is no source info

It can happen that the originator of a crash report doesn't have access
to certain images. When that's the case, ReportCrash won't show the
source info in the crash report stack frames, but only the stack address
and image name.

This patch fixes a bug in the crashlog stackframe parser regular
expression to optionally match the source info group.

rdar://101934135

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index 47250f3b350f1..c3a450ccb14bd 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@ class TextCrashLogParser(CrashLogParser):
  r'(.+?)\s+'   # img_name
  r'(?:' +version+ r'\s+)?' # img_version
  r'(0x[0-9a-fA-F]{4,})'# addr (4 chars or more)
- r' +(.*)' # offs
+ r'(?: +(.*))?'# offs
 )
 null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
 image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'  # img_lo

diff  --git 
a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash 
b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
index 16a95586a13b4..4361ed5020028 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@ Terminating Process:   exc handler [21606]
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out  @foo@ foo + 16 (test.c:3)
-1   a.out  @bar@ bar + 9 (test.c:6)
+1   a.out  @bar@
 2   a.out  @main@ main + 20 (test.c:8)
 3   libdyld.dylib  0x100 start + 1
 



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


[Lldb-commits] [PATCH] D125860: [clang] Only use major version in resource dir

2022-11-04 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM. Considering 
https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094
  and this thread, I think overall people favor this patch.

If a distribution wants to provide 16.0 and 16.1 simultaneously, the two 
installations can be in different install prefixes :)


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

https://reviews.llvm.org/D125860

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


[Lldb-commits] [PATCH] D137003: [lldb-vscode] Send Statistics Dump in terminated event

2022-11-04 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D137003#3908918 , @shafik wrote:

> It looks like this change broke `TestVSCode_terminatedEvent.py` see Green 
> Dragon build bot: 
> https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48111/
>
> Please fix or revert.

So this issue is a memory ownership issue with the way that llvm::json::Object 
stores its keys. It uses a llvm::json::ObjectKey which either creates a copy of 
the string if it is constructed with a std::string or if the string passed in 
isn't valid UTF8. If you construct a key with a "const char *" or a 
"llvm::StringRef" then the ObjectKey doesn't own the key string. The issue that 
happened here was that "void addStatistic(llvm::json::Object )" was used 
to get the statistics from LLDB as a lldb::SBStructuredData object. Then we 
asked for all top level keys using:

  lldb::SBStringList keys;
  if (!statistics.GetKeys(keys))
return;

This is a class that owns a std::vector inside of LLDB. Then we 
called "void FilterAndGetValueForKey(...) and passed it each key:

  for (size_t i = 0; i < keys.GetSize(); i++) {
const char *key = keys.GetStringAtIndex(i);
FilterAndGetValueForKey(statistics, key, stats_body);
  }

Now in FilterAndGetValueForKey(...), for most emplacing of key/value pairs, it 
was using this:

  std::string key_utf8 = llvm::json::fixUTF8(key);

As the key, but some places used the "key" which was a "const char *", which is 
owned by the "lldb::SBStringList keys" from "addStatistic(...)". These keys are 
not owned since they were added using the "const char *key", which means as 
soon as we return from "addStatistic(...)" and then from 
"CreateTerminatedEventObject()" these string values can change since they are 
on the heap. It all depends if anyone mallocs memory in the same place that 
these strings used to live. So depends on the OS and how the allocator works 
and how busy the allocator is in the current process.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137003

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


[Lldb-commits] [PATCH] D134066: [LLDB][NativePDB] Forcefully complete a record type if it has empty debug info and is required to have complete type.

2022-11-04 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu marked an inline comment as done.
zequanwu added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp:96
   CompilerType method_ct = m_ast_builder.ToCompilerType(method_qt);
-  lldb::opaque_compiler_type_t derived_opaque_ty = 
m_derived_ct.GetOpaqueQualType();
+  PdbAstBuilder::RequireCompleteType(method_ct);
+  lldb::opaque_compiler_type_t derived_opaque_ty =

zequanwu wrote:
> labath wrote:
> > I suppose this won't hurt, but `RequireCompleteType` will not actually do 
> > anything for method types, right ?
> > 
> > Regarding method types, there is a slightly different problem. C++ rules 
> > require that in code like
> > `struct B1 { virtual A1* f(); }; struct B2:B1 { A2* f(); };`, the types 
> > `A1` and `A2` must be complete (because that code is only valid if A1 is a 
> > base of A2). However, I think that's better left to a separate patch.
> > I suppose this won't hurt, but RequireCompleteType will not actually do 
> > anything for method types, right ?
> Yeah, it should do nothing. I just replaced all occurrence of CompleteType 
> with RequireCompleteType.
> Regarding method types, there is a slightly different problem. C++ rules 
> require that in code like
> struct B1 { virtual A1* f(); }; struct B2:B1 { A2* f(); };, the types A1 and 
> A2 must be complete (because that code is only valid if A1 is a base of A2). 
> However, I think that's better left to a separate patch.

I tried this example. It crashed and reminds me of a similar crash stack I seen 
at https://bugs.chromium.org/p/chromium/issues/detail?id=1359144#c4. I tried to 
call `PdbAstBuilder::RequireCompleteType` with the method return type, still 
not working. Not sure what's missing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134066

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


[Lldb-commits] [lldb] 03c7cd3 - Revert "[lldb-vscode] Send Statistics Dump in terminated event"

2022-11-04 Thread George Hu via lldb-commits

Author: George Hu
Date: 2022-11-04T15:37:18-07:00
New Revision: 03c7cd3a616b731cf041fbf164078b349223c4ef

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

LOG: Revert "[lldb-vscode] Send Statistics Dump in terminated event"

This reverts commit e3ccbae309273900a42e30b606c15c873d57f1ea.

There is a bug which is failing the test running on mac.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/tools/lldb-vscode/JSONUtils.h
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 
lldb/test/API/tools/lldb-vscode/terminated-event/Makefile

lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
lldb/test/API/tools/lldb-vscode/terminated-event/foo.cpp
lldb/test/API/tools/lldb-vscode/terminated-event/foo.h
lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp



diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index c2de4ad5c7d9a..d6a6abca53e38 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -369,13 +369,7 @@ def wait_for_stopped(self, timeout=None):
 def wait_for_exited(self):
 event_dict = self.wait_for_event('exited')
 if event_dict is None:
-raise ValueError("didn't get exited event")
-return event_dict
-
-def wait_for_terminated(self):
-event_dict = self.wait_for_event('terminated')
-if event_dict is None:
-raise ValueError("didn't get terminated event")
+raise ValueError("didn't get stopped event")
 return event_dict
 
 def get_initialize_value(self, key):

diff  --git a/lldb/test/API/tools/lldb-vscode/terminated-event/Makefile 
b/lldb/test/API/tools/lldb-vscode/terminated-event/Makefile
deleted file mode 100644
index b30baf48b972e..0
--- a/lldb/test/API/tools/lldb-vscode/terminated-event/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-DYLIB_NAME := foo
-DYLIB_CXX_SOURCES := foo.cpp
-CXX_SOURCES := main.cpp
-
-LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)"
-USE_LIBDL :=1
-
-include Makefile.rules
-
-all: a.out.stripped
-
-a.out.stripped:
-   strip -o a.out.stripped a.out
-
-ifneq "$(CODESIGN)" ""
-   $(CODESIGN) -fs - a.out.stripped
-endif
\ No newline at end of file

diff  --git 
a/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
 
b/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
deleted file mode 100644
index a288012530881..0
--- 
a/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
+++ /dev/null
@@ -1,61 +0,0 @@
-"""
-Test lldb-vscode terminated event
-"""
-
-import vscode
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import lldbvscode_testcase
-import re
-import json
-
-class TestVSCode_terminatedEvent(lldbvscode_testcase.VSCodeTestCaseBase):
-
-@skipIfWindows
-@skipIfRemote
-def test_terminated_event(self):
-'''
-Terminated Event
-Now contains the statistics of a debug session:
-metatdata:
-totalDebugInfoByteSize > 0
-totalDebugInfoEnabled > 0
-totalModuleCountHasDebugInfo > 0
-...
-targetInfo:
-totalBreakpointResolveTime > 0
-breakpoints:
-recognize function breakpoint
-recognize source line breakpoint
-It should contains the breakpoints info: function bp & source line 
bp
-'''
-
-program_basename = "a.out.stripped"
-program = self.getBuildArtifact(program_basename)
-self.build_and_launch(program)
-# Set breakpoints
-functions = ['foo']
-breakpoint_ids = self.set_function_breakpoints(functions)
-self.assertEquals(len(breakpoint_ids), len(functions), 'expect one 
breakpoint')
-main_bp_line = line_number('main.cpp', '// main breakpoint 1')
-breakpoint_ids.append(self.set_source_breakpoints('main.cpp', 
[main_bp_line]))
-
-self.continue_to_breakpoints(breakpoint_ids)
-self.continue_to_exit()
-
-statistics = self.vscode.wait_for_terminated()['statistics']
-self.assertTrue(statistics['totalDebugInfoByteSize'] > 0)
-self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
-self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
-
-# lldb-vscode debugs one target at a time
-target = json.loads(statistics['targets'])[0]
-

[Lldb-commits] [lldb] 7b7ec60 - Fix test TestVSCode_terminatedEvent.py

2022-11-04 Thread Wanyi Ye via lldb-commits

Author: Wanyi Ye
Date: 2022-11-04T14:54:29-07:00
New Revision: 7b7ec60dccb5f44d33c36e89bd4df008c618468b

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

LOG: Fix test TestVSCode_terminatedEvent.py

This test is broken due to the flaky encoding of top-level JSON key 'memory'
When I run locally (linux) the test passed. However, it failed the build bot: 
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48111/
I will find a way to repro before I can actually fix this issue correctly.

https://reviews.llvm.org/D137455

Added: 


Modified: 

lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
 
b/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
index bc516a0ed0e37..a288012530881 100644
--- 
a/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
+++ 
b/lldb/test/API/tools/lldb-vscode/terminated-event/TestVSCode_terminatedEvent.py
@@ -49,8 +49,6 @@ def test_terminated_event(self):
 self.assertTrue(statistics['totalDebugInfoEnabled'] > 0)
 self.assertTrue(statistics['totalModuleCountHasDebugInfo'] > 0)
 
-self.assertIsNotNone(statistics['memory'])
-
 # lldb-vscode debugs one target at a time
 target = json.loads(statistics['targets'])[0]
 self.assertTrue(target['totalBreakpointResolveTime'] > 0)



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


[Lldb-commits] [PATCH] D137466: [lldb/crashlog] Fix frame parser regex for when there is no source info

2022-11-04 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added reviewers: kastiglione, JDevlieghere.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

It can happen that the originator of a crash report doesn't have access
to certain images. When that's the case, ReportCrash won't show the
source info in the crash report stack frames, but only the stack address
and image name.

This patch fixes a bug in the crashlog stackframe parser regular
expression to optionally match the source info group.

rdar://101934135

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137466

Files:
  lldb/examples/python/crashlog.py
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
===
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out  @foo@ foo + 16 (test.c:3)
-1   a.out  @bar@ bar + 9 (test.c:6)
+1   a.out  @bar@
 2   a.out  @main@ main + 20 (test.c:8)
 3   libdyld.dylib  0x100 start + 1
 
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@
  r'(.+?)\s+'   # img_name
  r'(?:' +version+ r'\s+)?' # img_version
  r'(0x[0-9a-fA-F]{4,})'# addr (4 chars or more)
- r' +(.*)' # offs
+ r'(?: +(.*))?'# offs
 )
 null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
 image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'  # img_lo


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
===
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.crash
@@ -29,7 +29,7 @@
 
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   a.out 	@foo@ foo + 16 (test.c:3)
-1   a.out 	@bar@ bar + 9 (test.c:6)
+1   a.out 	@bar@
 2   a.out 	@main@ main + 20 (test.c:8)
 3   libdyld.dylib 	0x100 start + 1
 
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -645,7 +645,7 @@
  r'(.+?)\s+'   # img_name
  r'(?:' +version+ r'\s+)?' # img_version
  r'(0x[0-9a-fA-F]{4,})'# addr (4 chars or more)
- r' +(.*)' # offs
+ r'(?: +(.*))?'# offs
 )
 null_frame_regex = re.compile(r'^\d+\s+\?\?\?\s+0{4,} +')
 image_regex_uuid = re.compile(r'(0x[0-9a-fA-F]+)'  # img_lo
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134066: [LLDB][NativePDB] Forcefully complete a record type it has incomplete type debug info.

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



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp:96
   CompilerType method_ct = m_ast_builder.ToCompilerType(method_qt);
-  lldb::opaque_compiler_type_t derived_opaque_ty = 
m_derived_ct.GetOpaqueQualType();
+  PdbAstBuilder::RequireCompleteType(method_ct);
+  lldb::opaque_compiler_type_t derived_opaque_ty =

labath wrote:
> I suppose this won't hurt, but `RequireCompleteType` will not actually do 
> anything for method types, right ?
> 
> Regarding method types, there is a slightly different problem. C++ rules 
> require that in code like
> `struct B1 { virtual A1* f(); }; struct B2:B1 { A2* f(); };`, the types `A1` 
> and `A2` must be complete (because that code is only valid if A1 is a base of 
> A2). However, I think that's better left to a separate patch.
> I suppose this won't hurt, but RequireCompleteType will not actually do 
> anything for method types, right ?
Yeah, it should do nothing. I just replaced all occurrence of CompleteType with 
RequireCompleteType.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp:159
   CompilerType member_ct = m_ast_builder.ToCompilerType(member_type);
+  PdbAstBuilder::RequireCompleteType(member_ct);
 

labath wrote:
> Are you sure about static member part? Something like `struct A; struct B { 
> static A a; };` will compile fine (unlike `struct A; struct B { A a; };`), so 
> I'd hope that the expression evaluator could handle an incomplete static 
> member. It would be better if `p B::a` produces something like `error: 
> variable has incomplete type 'A'` instead of printing an empty struct.
Removed. 



Comment at: lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp:25
+B b;
+B b_array[3] = {};
+A C::static_a = A();

labath wrote:
> The `A a_array[]` case is more interesting, because here the class might be 
> (and probably will be) completed as a part of completing B. It would also be 
> better to use a different incomplete class for each test case, as a class can 
> be completed only once.
Printing `A a_array[]` will give error: use of undeclared identifier. Because 
the element type size is 0 and the number of element is calculated by 
total_size/element_type_size, it won't able to create type in this case. The 
size of B is 4 bytes, so it's able to print b_array.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134066

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


[Lldb-commits] [PATCH] D134066: [LLDB][NativePDB] Forcefully complete a record type it has incomplete type debug info.

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

Update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134066

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
  lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp
  lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp

Index: lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
@@ -0,0 +1,30 @@
+// clang-format off
+// REQUIRES: lld, x86
+
+// RUN: %clang_cl --target=x86_64-windows-msvc -c /Fo%t1.obj -- %p/Inputs/incomplete-tag-type.cpp
+// RUN: %clang_cl --target=x86_64-windows-msvc /O1 /Z7 -c /Fo%t2.obj -- %s
+// RUN: lld-link /debug:full /nodefaultlib /entry:main %t1.obj %t2.obj /out:%t.exe /pdb:%t.pdb
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe \
+// RUN:   -o "p b" -o "p d" -o "exit" | FileCheck %s
+
+// CHECK: (lldb) p b
+// CHECK: (B) $0 = {}
+// CHECK: (lldb) p d
+// CHECK: (D) $1 = {}
+
+// Complete base class.
+struct A { int x; A(); };
+struct B : A {};
+B b;
+
+// Complete data member.
+struct C {
+  C();
+};
+
+struct D {
+  C c;
+};
+D d;
+
+int main(){}
Index: lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/NativePDB/Inputs/incomplete-tag-type.cpp
@@ -0,0 +1,10 @@
+struct A {
+  int x;
+  A();
+};
+A::A() : x(47) {}
+
+struct C {
+  C();
+};
+C::C() = default;
Index: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -92,9 +92,10 @@
   m_ast_builder.GetOrCreateType(PdbTypeSymId(type_idx));
   if (method_qt.isNull())
 return;
-  m_ast_builder.CompleteType(method_qt);
   CompilerType method_ct = m_ast_builder.ToCompilerType(method_qt);
-  lldb::opaque_compiler_type_t derived_opaque_ty = m_derived_ct.GetOpaqueQualType();
+  PdbAstBuilder::RequireCompleteType(method_ct);
+  lldb::opaque_compiler_type_t derived_opaque_ty =
+  m_derived_ct.GetOpaqueQualType();
   auto iter = m_cxx_record_map.find(derived_opaque_ty);
   if (iter != m_cxx_record_map.end()) {
 if (iter->getSecond().contains({name, method_ct})) {
@@ -253,7 +254,7 @@
   clang::QualType member_qt = m_ast_builder.GetOrCreateType(PdbTypeSymId(ti));
   if (member_qt.isNull())
 return Error::success();
-  m_ast_builder.CompleteType(member_qt);
+  PdbAstBuilder::RequireCompleteType(m_ast_builder.ToCompilerType(member_qt));
   lldb::AccessType access = TranslateMemberAccess(data_member.getAccess());
   size_t field_size =
   bitfield_width ? bitfield_width : GetSizeOfType(ti, m_index.tpi()) * 8;
@@ -310,6 +311,18 @@
 bases.push_back(std::move(ib.second));
 
   TypeSystemClang  = m_ast_builder.clang();
+  // Make sure all base classes refer to complete types and not forward
+  // declarations. If we don't do this, clang will crash with an
+  // assertion in the call to clang_type.TransferBaseClasses()
+  for (const auto _class : bases) {
+clang::TypeSourceInfo *type_source_info =
+base_class->getTypeSourceInfo();
+if (type_source_info) {
+  PdbAstBuilder::RequireCompleteType(
+  clang.GetType(type_source_info->getType()));
+}
+  }
+
   clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(), std::move(bases));
 
   clang.AddMethodOverridesForCXXRecordType(m_derived_ct.GetOpaqueQualType());
Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
@@ -87,6 +87,7 @@
   ClangASTImporter () { return m_importer; }
 
   void Dump(Stream );
+  static void RequireCompleteType(CompilerType type);
 
 private:
   clang::Decl *TryGetDecl(PdbSymUid uid) const;
Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -1170,7 +1170,9 @@
 return {};
   uint64_t element_count = ar.Size / element_size;
 
-  CompilerType array_ct = m_clang.CreateArrayType(ToCompilerType(element_type),
+  CompilerType element_ct = ToCompilerType(element_type);
+  RequireCompleteType(element_ct);
+  CompilerType array_ct = 

[Lldb-commits] [PATCH] D137464: [NFC][lldb] Remove unnecessary branch in TypeSystemClang::DumpTypeDescription()

2022-11-04 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks created this revision.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137464

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
@@ -9221,14 +9221,8 @@
   if (level == eDescriptionLevelVerbose)
 record_decl->dump(llvm_ostrm);
   else {
-if (auto *cxx_record_decl =
-llvm::dyn_cast(record_decl))
-  cxx_record_decl->print(llvm_ostrm,
- getASTContext().getPrintingPolicy(),
- s->GetIndentLevel());
-else
-  record_decl->print(llvm_ostrm, getASTContext().getPrintingPolicy(),
- s->GetIndentLevel());
+record_decl->print(llvm_ostrm, getASTContext().getPrintingPolicy(),
+   s->GetIndentLevel());
   }
 } break;
 


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -9221,14 +9221,8 @@
   if (level == eDescriptionLevelVerbose)
 record_decl->dump(llvm_ostrm);
   else {
-if (auto *cxx_record_decl =
-llvm::dyn_cast(record_decl))
-  cxx_record_decl->print(llvm_ostrm,
- getASTContext().getPrintingPolicy(),
- s->GetIndentLevel());
-else
-  record_decl->print(llvm_ostrm, getASTContext().getPrintingPolicy(),
- s->GetIndentLevel());
+record_decl->print(llvm_ostrm, getASTContext().getPrintingPolicy(),
+   s->GetIndentLevel());
   }
 } break;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137003: [lldb-vscode] Send Statistics Dump in terminated event

2022-11-04 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour added a comment.

In D137003#3908918 , @shafik wrote:

> It looks like this change broke `TestVSCode_terminatedEvent.py` see Green 
> Dragon build bot: 
> https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48111/
>
> Please fix or revert.

I will fix test by disabling checking the 'memory' filed. However, when I run 
the test locally, I got different results, see below:

  
{"event":"terminated","seq":0,"statistics":{"memory":"{\"strings\":{\"bytesTotal\":1843200,\"bytesUnused\":897741,\"bytesUsed\":945459}}","targets":"[{\"breakpoints\":[{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"NameMask\":[56],\"Offset\":0,\"SkipPrologue\":true,\"SymbolNames\":[\"foo\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"Names\":[\"vscode\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"id\":1,\"internal\":false,\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.0020691},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Column\":0,\"Exact\":false,\"FileName\":\"/data/users/wanyi/llvm-sand/external/llvm-project/lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp\",\"Inlines\":true,\"LineNumber\":5,\"Offset\":0,\"SkipPrologue\":true},\"Type\":\"FileAndLine\"},\"Hardware\":false,\"Names\":[\"vscode\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"id\":2,\"internal\":false,\"numLocations\":0,\"numResolvedLocations\":0,\"resolveTime\":0.256624999},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Language\":\"c\",\"NameMask\":[4,4,4,4,4,4],\"Offset\":0,\"SkipPrologue\":false,\"SymbolNames\":[\"_dl_debug_state\",\"rtld_db_dlactivity\",\"__dl_rtld_db_dlactivity\",\"r_debug_state\",\"_r_debug_state\",\"_rtld_debug_state\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"SearchFilter\":{\"Options\":{\"ModuleList\":[\"/usr/lib64/ld-2.28.so\"]},\"Type\":\"Modules\"}}},\"id\":-1,\"internal\":true,\"kindDescription\":\"shared-library-event\",\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.00036601}],\"expressionEvaluation\":{\"failures\":0,\"successes\":0},\"firstStopTime\":0.163219069,\"frameVariable\":{\"failures\":0,\"successes\":0},\"launchOrAttachTime\":0.124005952,\"moduleIdentifiers\":[94453879969136,94453879680352,94453878991776,139787361446016,139787361476896,139787361522272,139787361656656,139787361825984,139787361883552],\"signals\":[{\"SIGSTOP\":1}],\"sourceMapDeduceCount\":0,\"stopCount\":8,\"targetCreateTime\":0.00060895,\"totalBreakpointResolveTime\":0.259059996}]","totalDebugInfoByteSize":1668056,"totalDebugInfoEnabled":3,"totalDebugInfoIndexLoadedFromCache":0,"totalDebugInfoIndexSavedToCache":0,"totalDebugInfoIndexTime":0.0325389998,"totalDebugInfoParseTime":0.371056,"totalModuleCount":10,"totalModuleCountHasDebugInfo":3,"totalSymbolTableIndexTime":0.051369,"totalSymbolTableParseTime":0.228127002,"totalSymbolTableStripped":0,"totalSymbolTablesLoadedFromCache":0,"totalSymbolTablesSavedToCache":0},"type":"event"}
  --> 
  Content-Length: 88
  
  
{"command":"disconnect","type":"request","arguments":{"terminateDebuggee":true},"seq":8}
  <-- 
  Content-Length: 81
  
  
{"command":"disconnect","request_seq":8,"seq":0,"success":true,"type":"response"}
  
  = END =
  PASS: LLDB 
(/data/users/wanyi/llvm-sand/build/Debug/fbcode-x86_64/toolchain/bin/clang-x86_64)
 :: test_terminated_event 
(TestVSCode_terminatedEvent.TestVSCode_terminatedEvent)
  --
  Ran 1 test in 7.237s
  
  RESULT: PASSED (1 passes, 0 failures, 0 errors, 0 skipped, 0 expected 
failures, 0 unexpected successes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137003

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


[Lldb-commits] [PATCH] D137003: [lldb-vscode] Send Statistics Dump in terminated event

2022-11-04 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.
Herald added a subscriber: JDevlieghere.

It looks like this change broke `TestVSCode_terminatedEvent.py` see Green 
Dragon build bot: 
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48111/

Please fix or revert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137003

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


[Lldb-commits] [PATCH] D135547: [lldb/Utility] Add GetDescription(Stream&) to StructureData::*

2022-11-04 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added inline comments.



Comment at: lldb/unittests/Utility/StructuredDataTest.cpp:41
+  object_sp->GetDescription(S);
+  EXPECT_EQ(0, S.GetSize());
+}

shafik wrote:
> When doing a build I am seeing:
> 
> ```
> warning: comparison of integers of different signs: 'const int' and 'const 
> unsigned long' [-Wsign-compare]
> ```
I'll fix that! Thanks @shafik :) !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135547

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


[Lldb-commits] [PATCH] D135547: [lldb/Utility] Add GetDescription(Stream&) to StructureData::*

2022-11-04 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/unittests/Utility/StructuredDataTest.cpp:41
+  object_sp->GetDescription(S);
+  EXPECT_EQ(0, S.GetSize());
+}

When doing a build I am seeing:

```
warning: comparison of integers of different signs: 'const int' and 'const 
unsigned long' [-Wsign-compare]
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135547

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


[Lldb-commits] [lldb] b6cf94e - Fix format specifier warning in EmulateInstructionRISCV more

2022-11-04 Thread Benjamin Kramer via lldb-commits

Author: Benjamin Kramer
Date: 2022-11-04T18:58:43+01:00
New Revision: b6cf94e973f9659086633ca56dc51bc74d4125eb

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

LOG: Fix format specifier warning in EmulateInstructionRISCV more

Yes, the portable macro is still the only way to do this.

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index 7b2f8c81e44b..c05b43f300fd 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -504,7 +504,9 @@ llvm::Optional 
EmulateInstructionRISCV::Decode(uint32_t inst) {
 
   for (const InstrPattern  : PATTERNS) {
 if ((inst & pat.type_mask) == pat.eigen) {
-  LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(%x at %llx) was 
decoded to %s",
+  LLDB_LOGF(log,
+"EmulateInstructionRISCV::%s: inst(%x at %" PRIx64
+") was decoded to %s",
 __FUNCTION__, inst, m_addr, pat.name);
   auto decoded = is_rvc ? pat.decode(try_rvc) : pat.decode(inst);
   return DecodeResult{decoded, inst, is_rvc, pat};



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


[Lldb-commits] [lldb] 234e08e - [lldb] Fix format specifier warning in EmulateInstructionRISCV

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

Author: Jonas Devlieghere
Date: 2022-11-04T10:46:31-07:00
New Revision: 234e08ec3c1a94bf67ee78c25d1c5241cc69aaa5

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

LOG: [lldb] Fix format specifier warning in EmulateInstructionRISCV

Fixes warning: format specifies type 'unsigned long' but the argument
has type 'lldb::addr_t' (aka 'unsigned long long') [-Wformat]

Added: 


Modified: 
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp 
b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index 1d8f3a2750277..7b2f8c81e44bc 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -504,7 +504,7 @@ llvm::Optional 
EmulateInstructionRISCV::Decode(uint32_t inst) {
 
   for (const InstrPattern  : PATTERNS) {
 if ((inst & pat.type_mask) == pat.eigen) {
-  LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(%x at %lx) was decoded 
to %s",
+  LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(%x at %llx) was 
decoded to %s",
 __FUNCTION__, inst, m_addr, pat.name);
   auto decoded = is_rvc ? pat.decode(try_rvc) : pat.decode(inst);
   return DecodeResult{decoded, inst, is_rvc, pat};



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


[Lldb-commits] [PATCH] D137287: [Test] Fix CHECK typo.

2022-11-04 Thread Zequan Wu via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa7fa5febaa43: [Test] Fix CHECK typo. (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137287

Files:
  
clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
  clang/test/CodeGenCoroutines/pr56329.cpp
  clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  flang/test/Lower/ext-proc-as-actual-argument-1.f90
  flang/test/Lower/ext-proc-as-actual-argument-2.f90
  flang/test/Lower/fail_image.f90
  lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
  llvm/test/CodeGen/PowerPC/livevars-crash2.mir
  llvm/test/CodeGen/PowerPC/phi-eliminate.mir
  llvm/test/CodeGen/PowerPC/vsx-args.ll
  llvm/test/DebugInfo/MIR/InstrRef/pick-vphi-in-shifting-loop.mir
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/type-checker-emit-after-unreachable.s
  llvm/test/Transforms/Coroutines/coro-debug.ll
  llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
  mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
  mlir/test/Dialect/MemRef/canonicalize.mlir
  mlir/test/Dialect/Tensor/canonicalize.mlir
  mlir/test/python/ir/affine_expr.py

Index: mlir/test/python/ir/affine_expr.py
===
--- mlir/test/python/ir/affine_expr.py
+++ mlir/test/python/ir/affine_expr.py
@@ -116,7 +116,7 @@
 
 # CHECK: 2
 print(s2.position)
-# CHEKC: s2
+# CHECK: s2
 print(s2)
 
 assert s1 == s11
Index: mlir/test/Dialect/Tensor/canonicalize.mlir
===
--- mlir/test/Dialect/Tensor/canonicalize.mlir
+++ mlir/test/Dialect/Tensor/canonicalize.mlir
@@ -353,7 +353,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor to tensor<4x1x?xf32>
 //   CHECK:   %[[RESULT:.+]] = tensor.cast %[[SLICE]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -372,7 +372,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor to tensor<4x?xf32>
 //   CHECK:   %[[RESULT:.+]] = tensor.cast %[[SLICE]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -467,7 +467,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[SLICE]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x1x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -486,7 +486,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[CAST]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -509,7 +509,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[SLICE]] into %[[ARG3]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
Index: mlir/test/Dialect/MemRef/canonicalize.mlir
===
--- mlir/test/Dialect/MemRef/canonicalize.mlir
+++ mlir/test/Dialect/MemRef/canonicalize.mlir
@@ -57,7 +57,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : memref to memref<4x1x?xf32
 //   CHECK:   %[[RESULT:.+]] = memref.cast %[[SUBVIEW]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
Index: mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
===
--- mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
+++ mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
@@ -148,7 +148,7 @@
 // CHECK-LABEL: @powf_vector
 func.func @powf_vector(%lhs: vector<4xf32>, %rhs: vector<4xf32>) -> vector<4xf32> {
   // CHECK: spirv.FOrdLessThan
-  // CHEKC: spirv.GL.FAbs
+  // CHECK: spirv.GL.FAbs
   // CHECK: spirv.GL.Pow %{{.*}}: vector<4xf32>
   // CHECK: spirv.FNegate
   // CHECK: spirv.Select
Index: llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
===
--- llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
+++ llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
@@ -91,7 +91,7 @@
 ; CHECK:  1: 4
 ; CHECK:  2: 3
 ; CHECK:  3: 1
-; CEHCK:  5: 4 fb:4
+; CHECK:  5: 4 fb:4
 ; CHECK:  6: 1 fa:1
 ; CHECK !CFGChecksum: 563022570642068
 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:6:2
Index: 

[Lldb-commits] [lldb] a7fa5fe - [Test] Fix CHECK typo.

2022-11-04 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-11-04T10:18:04-07:00
New Revision: a7fa5febaa43d860cbd6a4061f239b283c4d8032

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

LOG: [Test] Fix CHECK typo.

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

Added: 


Modified: 

clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
clang/test/CodeGenCoroutines/pr56329.cpp
clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
clang/test/OpenMP/target_parallel_for_codegen.cpp
flang/test/Lower/ext-proc-as-actual-argument-1.f90
flang/test/Lower/ext-proc-as-actual-argument-2.f90
flang/test/Lower/fail_image.f90
lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
llvm/test/CodeGen/PowerPC/livevars-crash2.mir
llvm/test/CodeGen/PowerPC/phi-eliminate.mir
llvm/test/CodeGen/PowerPC/vsx-args.ll
llvm/test/DebugInfo/MIR/InstrRef/pick-vphi-in-shifting-loop.mir
llvm/test/MC/WebAssembly/tag-section-decoding.ll
llvm/test/MC/WebAssembly/type-checker-emit-after-unreachable.s
llvm/test/Transforms/Coroutines/coro-debug.ll
llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
mlir/test/Dialect/MemRef/canonicalize.mlir
mlir/test/Dialect/Tensor/canonicalize.mlir
mlir/test/python/ir/affine_expr.py

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
 
b/clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
index 8791dd952319d..8a483049c8cd5 100644
--- 
a/clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
+++ 
b/clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
@@ -1,4 +1,4 @@
 class MyType {};
 // CHECK: #include 
 // CHECK-NEXT: #include 
-// CEHCK-NEXT: class MyType {};
+// CHECK-NEXT: class MyType {};

diff  --git a/clang/test/CodeGenCoroutines/pr56329.cpp 
b/clang/test/CodeGenCoroutines/pr56329.cpp
index 2e9a1a244e218..855755d05f844 100644
--- a/clang/test/CodeGenCoroutines/pr56329.cpp
+++ b/clang/test/CodeGenCoroutines/pr56329.cpp
@@ -116,4 +116,4 @@ Task Outer() {
 // CHECK: musttail call
 // CHECK: musttail call
 // CHECK-NEXT: ret void
-// CHEKC-NEXT: }
+// CHECK-NEXT: }

diff  --git a/clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c 
b/clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
index 9667f9cc549d3..25bfbb7c815de 100644
--- a/clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
+++ b/clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
@@ -17,6 +17,6 @@ void sub(double *restrict a, double *restrict b, int n) {
 // CHECK:   omp.precond.then:
 // CHECK-NEXT:call void @llvm.instrprof.increment(
 // CHECK:   cond.true:
-// CEHCK-NEXT:call void @llvm.instrprof.increment(
+// CHECK-NEXT:call void @llvm.instrprof.increment(
 // CHECK:   omp.inner.for.body:
 // CHECK-NEXT:call void @llvm.instrprof.increment(

diff  --git a/clang/test/OpenMP/target_parallel_for_codegen.cpp 
b/clang/test/OpenMP/target_parallel_for_codegen.cpp
index f6946165cfd3b..8f14afb70c674 100644
--- a/clang/test/OpenMP/target_parallel_for_codegen.cpp
+++ b/clang/test/OpenMP/target_parallel_for_codegen.cpp
@@ -112,18 +112,18 @@ int foo(int n) {
 a += 1;
   }
 
-  // CEHCK-32:[[FPSIZEGEP]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 0
-  // CEHCK-32:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPSIZEGEP]], 
ptr align 8 [[SIZET2]], i64 24, i1 false)
-  // CEHCK-32:[[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 1
-  // CEHCK-32:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPBPGEP]], 
ptr align 8 [[BPGEP]], i64 24, i1 false)
-  // CEHCK-32:[[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 2
-  // CEHCK-32:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPPGEP]], ptr 
align 8 [[BCAST]], i64 24, i1 false)
-  // CEHCK-64:[[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 0
-  // CEHCK-64:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPBPGEP]], 
ptr align 8 [[BPGEP]], i64 24, i1 false)
-  // CEHCK-64:[[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 1
-  // CEHCK-64:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPPGEP]], ptr 
align 8 [[BCAST]], i64 24, i1 false)
-  // CEHCK-64:[[FPSIZEGEP]] = getelementptr inbounds [[KMP_PRIVATES_T]], 
ptr [[KMP_PRIVATES]], i32 0, i32 2
-  // CEHCK-64:call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[FPSIZEGEP]], 
ptr align 8 [[SIZET2]], i64 24, i1 

[Lldb-commits] [PATCH] D125860: [clang] Only use major version in resource dir

2022-11-04 Thread Timm Bäder via Phabricator via lldb-commits
tbaeder updated this revision to Diff 473208.

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

https://reviews.llvm.org/D125860

Files:
  clang/include/clang/Basic/Version.inc.in
  clang/lib/Driver/Driver.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Tooling/CMakeLists.txt
  clang/runtime/CMakeLists.txt
  compiler-rt/cmake/base-config-ix.cmake
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/unittests/Expression/ClangParserTest.cpp
  llvm/cmake/modules/LLVMExternalProjectUtils.cmake
  polly/lib/External/isl/interface/extract_interface.cc

Index: polly/lib/External/isl/interface/extract_interface.cc
===
--- polly/lib/External/isl/interface/extract_interface.cc
+++ polly/lib/External/isl/interface/extract_interface.cc
@@ -109,7 +109,7 @@
 	llvm::cl::value_desc("name"));
 
 static const char *ResourceDir =
-	CLANG_PREFIX "/lib/clang/" CLANG_VERSION_STRING;
+CLANG_PREFIX "/lib/clang/" CLANG_VERSION_MAJOR_STRING;
 
 /* Does decl have an attribute of the following form?
  *
Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -255,9 +255,9 @@
 set(llvm_config_path ${LLVM_CONFIG_PATH})
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+  string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR
  ${PACKAGE_VERSION})
-  set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}")
+  set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
   set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
   foreach(type ${flag_types})
 set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
Index: lldb/unittests/Expression/ClangParserTest.cpp
===
--- lldb/unittests/Expression/ClangParserTest.cpp
+++ lldb/unittests/Expression/ClangParserTest.cpp
@@ -38,10 +38,11 @@
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
   std::string path_to_clang_dir =
-  "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_STRING;
+  "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
-  std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir =
+  "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING;
 #endif
   EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -55,7 +55,7 @@
   static const llvm::StringRef kResourceDirSuffixes[] = {
   // LLVM.org's build of LLDB uses the clang resource directory placed
   // in $install_dir/lib{,64}/clang/$clang_version.
-  CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_STRING,
+  CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING,
   // swift-lldb uses the clang resource directory copied from swift, which
   // by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
   // it there, so we use LLDB_INSTALL_LIBDIR_BASENAME.
Index: compiler-rt/cmake/base-config-ix.cmake
===
--- compiler-rt/cmake/base-config-ix.cmake
+++ compiler-rt/cmake/base-config-ix.cmake
@@ -38,14 +38,14 @@
 
 if (LLVM_TREE_AVAILABLE)
   # Compute the Clang version from the LLVM version.
-  # FIXME: We should be able to reuse CLANG_VERSION variable calculated
+  # FIXME: We should be able to reuse CLANG_VERSION_MAJOR variable calculated
   #in Clang cmake files, instead of copying the rules here.
-  string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+  string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR
  ${PACKAGE_VERSION})
   # Setup the paths where compiler-rt runtimes and headers should be stored.
-  set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
+  set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR})
   set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-  set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
+  set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR})
   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
  ${LLVM_INCLUDE_TESTS})
   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
Index: clang/runtime/CMakeLists.txt

[Lldb-commits] [PATCH] D132624: [LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`

2022-11-04 Thread Adrian Vogelsgesang via Phabricator via lldb-commits
avogelsgesang added a comment.

@labath @aprantl Thank you for your reviews on https://reviews.llvm.org/D132815 
and https://reviews.llvm.org/D132735
I would appreciate if you also have time to review this change here, as it is a 
pre-requisite for the other two changes :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132624

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


[Lldb-commits] [PATCH] D134066: [LLDB][NativePDB] Forcefully complete a record type it has incomplete type debug info.

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



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp:1
+#include "/tmp/debug.h"
 #include "PdbAstBuilder.h"

oops?



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp:96
   CompilerType method_ct = m_ast_builder.ToCompilerType(method_qt);
-  lldb::opaque_compiler_type_t derived_opaque_ty = 
m_derived_ct.GetOpaqueQualType();
+  PdbAstBuilder::RequireCompleteType(method_ct);
+  lldb::opaque_compiler_type_t derived_opaque_ty =

I suppose this won't hurt, but `RequireCompleteType` will not actually do 
anything for method types, right ?

Regarding method types, there is a slightly different problem. C++ rules 
require that in code like
`struct B1 { virtual A1* f(); }; struct B2:B1 { A2* f(); };`, the types `A1` 
and `A2` must be complete (because that code is only valid if A1 is a base of 
A2). However, I think that's better left to a separate patch.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp:159
   CompilerType member_ct = m_ast_builder.ToCompilerType(member_type);
+  PdbAstBuilder::RequireCompleteType(member_ct);
 

Are you sure about static member part? Something like `struct A; struct B { 
static A a; };` will compile fine (unlike `struct A; struct B { A a; };`), so 
I'd hope that the expression evaluator could handle an incomplete static 
member. It would be better if `p B::a` produces something like `error: variable 
has incomplete type 'A'` instead of printing an empty struct.



Comment at: lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp:25
+B b;
+B b_array[3] = {};
+A C::static_a = A();

The `A a_array[]` case is more interesting, because here the class might be 
(and probably will be) completed as a part of completing B. It would also be 
better to use a different incomplete class for each test case, as a class can 
be completed only once.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134066

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


[Lldb-commits] [PATCH] D137137: [lldb/Interpreter] Open saved transcript in GUI Editor

2022-11-04 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG902ba8b0c9b0: [lldb/Interpreter] Open saved transcript in 
GUI Editor (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137137

Files:
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/InterpreterProperties.td


Index: lldb/source/Interpreter/InterpreterProperties.td
===
--- lldb/source/Interpreter/InterpreterProperties.td
+++ lldb/source/Interpreter/InterpreterProperties.td
@@ -13,6 +13,10 @@
 Global,
 DefaultFalse,
 Desc<"If true, LLDB will save the session's transcripts before quitting.">;
+  def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"If true, LLDB will open the saved session's transcripts in the 
external editor.">;
   def SaveSessionDirectory: Property<"save-session-directory", "FileSpec">,
 DefaultStringValue<"">,
 Desc<"A path where LLDB will save the session's transcripts. This is 
particularly useful when you can't set the session file, for example when using 
`save-session-on-quit`.">;
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -170,6 +170,17 @@
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
 }
 
+bool CommandInterpreter::GetOpenTranscriptInEditor() const {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0);
+}
+
+void CommandInterpreter::SetOpenTranscriptInEditor(bool enable) {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
+}
+
 FileSpec CommandInterpreter::GetSaveSessionDirectory() const {
   const uint32_t idx = ePropertySaveSessionDirectory;
   return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx);
@@ -3226,6 +3237,13 @@
   result.AppendMessageWithFormat("Session's transcripts saved to %s\n",
  output_file->c_str());
 
+  if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) {
+const FileSpec file_spec;
+error = file->GetFileSpec(const_cast(file_spec));
+if (error.Success())
+  Host::OpenFileInExternalEditor(file_spec, 1);
+  }
+
   return true;
 }
 
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -559,6 +559,9 @@
   bool GetSaveSessionOnQuit() const;
   void SetSaveSessionOnQuit(bool enable);
 
+  bool GetOpenTranscriptInEditor() const;
+  void SetOpenTranscriptInEditor(bool enable);
+
   FileSpec GetSaveSessionDirectory() const;
   void SetSaveSessionDirectory(llvm::StringRef path);
 


Index: lldb/source/Interpreter/InterpreterProperties.td
===
--- lldb/source/Interpreter/InterpreterProperties.td
+++ lldb/source/Interpreter/InterpreterProperties.td
@@ -13,6 +13,10 @@
 Global,
 DefaultFalse,
 Desc<"If true, LLDB will save the session's transcripts before quitting.">;
+  def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"If true, LLDB will open the saved session's transcripts in the external editor.">;
   def SaveSessionDirectory: Property<"save-session-directory", "FileSpec">,
 DefaultStringValue<"">,
 Desc<"A path where LLDB will save the session's transcripts. This is particularly useful when you can't set the session file, for example when using `save-session-on-quit`.">;
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -170,6 +170,17 @@
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
 }
 
+bool CommandInterpreter::GetOpenTranscriptInEditor() const {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0);
+}
+
+void CommandInterpreter::SetOpenTranscriptInEditor(bool enable) {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
+}
+
 FileSpec CommandInterpreter::GetSaveSessionDirectory() const {
   const uint32_t idx = 

[Lldb-commits] [lldb] 902ba8b - [lldb/Interpreter] Open saved transcript in GUI Editor

2022-11-04 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-03T23:13:13-07:00
New Revision: 902ba8b0c9b013043aa04dc548be3ec907ef5571

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

LOG: [lldb/Interpreter] Open saved transcript in GUI Editor

This patch will automatically open LLDB's saved transcript file on the
graphical editor if lldb is running under an interactive graphical session.

This can be controlled by a new setting: `interpreter.open-transcript-in-editor`

rdar://92692106

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/InterpreterProperties.td

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 255f50099ebb9..a72800b5409ca 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -559,6 +559,9 @@ class CommandInterpreter : public Broadcaster,
   bool GetSaveSessionOnQuit() const;
   void SetSaveSessionOnQuit(bool enable);
 
+  bool GetOpenTranscriptInEditor() const;
+  void SetOpenTranscriptInEditor(bool enable);
+
   FileSpec GetSaveSessionDirectory() const;
   void SetSaveSessionDirectory(llvm::StringRef path);
 

diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index eaad0195c1b74..3d0b61fa7d3c3 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -170,6 +170,17 @@ void CommandInterpreter::SetSaveSessionOnQuit(bool enable) 
{
   m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
 }
 
+bool CommandInterpreter::GetOpenTranscriptInEditor() const {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  return m_collection_sp->GetPropertyAtIndexAsBoolean(
+  nullptr, idx, g_interpreter_properties[idx].default_uint_value != 0);
+}
+
+void CommandInterpreter::SetOpenTranscriptInEditor(bool enable) {
+  const uint32_t idx = ePropertyOpenTranscriptInEditor;
+  m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, enable);
+}
+
 FileSpec CommandInterpreter::GetSaveSessionDirectory() const {
   const uint32_t idx = ePropertySaveSessionDirectory;
   return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx);
@@ -3226,6 +3237,13 @@ bool CommandInterpreter::SaveTranscript(
   result.AppendMessageWithFormat("Session's transcripts saved to %s\n",
  output_file->c_str());
 
+  if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) {
+const FileSpec file_spec;
+error = file->GetFileSpec(const_cast(file_spec));
+if (error.Success())
+  Host::OpenFileInExternalEditor(file_spec, 1);
+  }
+
   return true;
 }
 

diff  --git a/lldb/source/Interpreter/InterpreterProperties.td 
b/lldb/source/Interpreter/InterpreterProperties.td
index c0acc044fb7fe..2155ee61ccffb 100644
--- a/lldb/source/Interpreter/InterpreterProperties.td
+++ b/lldb/source/Interpreter/InterpreterProperties.td
@@ -13,6 +13,10 @@ let Definition = "interpreter" in {
 Global,
 DefaultFalse,
 Desc<"If true, LLDB will save the session's transcripts before quitting.">;
+  def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">,
+Global,
+DefaultTrue,
+Desc<"If true, LLDB will open the saved session's transcripts in the 
external editor.">;
   def SaveSessionDirectory: Property<"save-session-directory", "FileSpec">,
 DefaultStringValue<"">,
 Desc<"A path where LLDB will save the session's transcripts. This is 
particularly useful when you can't set the session file, for example when using 
`save-session-on-quit`.">;



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