[Lldb-commits] [lldb] 5c6ee13 - [LLDB] Skip TestProcessIOHandlerInterrupt Arm/AArch64 Linux

2022-03-28 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2022-03-28T12:32:49+05:00
New Revision: 5c6ee1305e771bd40b523b4de4df8bffaa2e98ad

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

LOG: [LLDB] Skip TestProcessIOHandlerInterrupt Arm/AArch64 Linux

This patch skips TestProcessIOHandlerInterrupt on Arm/AArch64.
PExpect tests are not stable when run in containerized machine.

Added: 


Modified: 
lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py

Removed: 




diff  --git a/lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py 
b/lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py
index 707c84eeacdac..b1d93b6a30b1c 100644
--- a/lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py
+++ b/lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py
@@ -13,6 +13,7 @@ class TestCase(PExpectTest):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test(self):
 self.build(dictionary={"CXX_SOURCES":"cat.cpp"})
 self.launch(executable=self.getBuildArtifact())



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


[Lldb-commits] [PATCH] D114627: [lldb] add new overload for SymbolFile::FindTypes that accepts a scope

2022-03-28 Thread Lasse Folger via Phabricator via lldb-commits
lassefolger added a comment.
Herald added a project: All.

Sorry for the very late response.

I looked into using the `CompilerDeclContext()`.

This does not work in this case because the context is not set in this specific 
use case and I'm not sure if it case be set.
It is initialized with an invalid context when the function is called 
.

The entry point in our use case is `lldb::SBTarget::FindTypes(const char *)`. A 
stacktrace looks like this:
SymbolFileDWARF::FindTypes()
lldb_private::Module::FindTypes_Impl()
lldb_private::ModuleList::FindTypes()
lldb::SBTarget::FindTypes()

Given that the input is just a C-string, I'm not sure how to derive a 
`CompilerDeclContext()` from that.
What we are trying to optimize is a call like:
`lldb.target.FindTypes("Some::Namespace::Type")`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114627

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


[Lldb-commits] [PATCH] D122568: [lldb] correct comment in deterministic build test

2022-03-28 Thread Michael Ford via Phabricator via lldb-commits
fanquake created this revision.
fanquake added a reviewer: lld-macho.
Herald added a subscriber: mgrang.
Herald added a project: All.
fanquake requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Since https://reviews.llvm.org/D103446, lld now also respects the ZERO_AR_DATE 
env var.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122568

Files:
  lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp


Index: lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
===
--- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
@@ -1,6 +1,5 @@
 // Test that binaries linked deterministically (N_OSO has timestamp 0) can 
still
-// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE
-// requires the ld64 linker, which clang invokes by default.
+// have their object files loaded by lldb.
 // REQUIRES: system-darwin
 // RUN: %clang_host %s -g -c -o %t.o
 // RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t


Index: lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
===
--- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
@@ -1,6 +1,5 @@
 // Test that binaries linked deterministically (N_OSO has timestamp 0) can still
-// have their object files loaded by lldb. Note that the env var ZERO_AR_DATE
-// requires the ld64 linker, which clang invokes by default.
+// have their object files loaded by lldb.
 // REQUIRES: system-darwin
 // RUN: %clang_host %s -g -c -o %t.o
 // RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 3631b90 - [lldb] Remove some unused functions from PosixApi.h

2022-03-28 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-03-28T15:14:19+02:00
New Revision: 3631b9014d4f9289219a0091ea4ebd635d7a517f

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

LOG: [lldb] Remove some unused functions from PosixApi.h

There are better llvm replacements for all of these.

Added: 


Modified: 
lldb/include/lldb/Host/windows/PosixApi.h
lldb/source/Host/windows/Windows.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/windows/PosixApi.h 
b/lldb/include/lldb/Host/windows/PosixApi.h
index 87908209d7167..563af50fd229e 100644
--- a/lldb/include/lldb/Host/windows/PosixApi.h
+++ b/lldb/include/lldb/Host/windows/PosixApi.h
@@ -84,12 +84,6 @@ typedef uint32_t pid_t;
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
 
-#define S_IFDIR _S_IFDIR
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
 #endif // _MSC_VER
 
 // Various useful posix functions that are not present in Windows.  We provide
@@ -99,9 +93,6 @@ char *strcasestr(const char *s, const char *find);
 
 #ifdef _MSC_VER
 
-char *basename(char *path);
-char *dirname(char *path);
-
 int strcasecmp(const char *s1, const char *s2);
 int strncasecmp(const char *s1, const char *s2, size_t n);
 
@@ -110,10 +101,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 // empty functions
 inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
 
-inline int strerror_r(int errnum, char *buf, size_t buflen) {
-  LLVM_BUILTIN_UNREACHABLE;
-}
-
 inline int unlockpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
 inline int grantpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
 inline char *ptsname(int fd) { LLVM_BUILTIN_UNREACHABLE; }

diff  --git a/lldb/source/Host/windows/Windows.cpp 
b/lldb/source/Host/windows/Windows.cpp
index 787f35930baf7..d2561a6c5b6df 100644
--- a/lldb/source/Host/windows/Windows.cpp
+++ b/lldb/source/Host/windows/Windows.cpp
@@ -64,27 +64,6 @@ char *strcasestr(const char *s, const char *find) {
 
 #ifdef _MSC_VER
 
-char *basename(char *path) {
-  char *l1 = strrchr(path, '\\');
-  char *l2 = strrchr(path, '/');
-  if (l2 > l1)
-l1 = l2;
-  if (!l1)
-return path; // no base name
-  return &l1[1];
-}
-
-char *dirname(char *path) {
-  char *l1 = strrchr(path, '\\');
-  char *l2 = strrchr(path, '/');
-  if (l2 > l1)
-l1 = l2;
-  if (!l1)
-return NULL; // no dir name
-  *l1 = 0;
-  return path;
-}
-
 int strcasecmp(const char *s1, const char *s2) { return stricmp(s1, s2); }
 
 int strncasecmp(const char *s1, const char *s2, size_t n) {



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


[Lldb-commits] [PATCH] D121999: [lldb][AArch64] Update disassembler feature list and add tests for all extensions

2022-03-28 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Wow. It sounds like we should figure out a way to enable all extensions with a 
single stroke. Otherwise, this will be an endless cat-and-mouse.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121999

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


[Lldb-commits] [PATCH] D122411: [lldb][AArch64] Fix corefile memory reads when there are non-address bits

2022-03-28 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D122411#3408204 , @DavidSpickett 
wrote:

> - Corefile down to 24k with some tweaking of coredump_filter

24k is pretty good. At this point, if you wanted to go down further, you'd 
probably have to ditch libc, which may not be as hard if you don't need mmap 
(the comment indicates that is because of lldb reading globals eagerly, but it 
can't read globals without having access to the exe file).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122411

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


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-28 Thread Danny Mösch via Phabricator via lldb-commits
SimplyDanny added a comment.

@tonic, can you please have another look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

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


[Lldb-commits] [PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2022-03-28 Thread Dávid Bolvanský via Phabricator via lldb-commits
xbolva00 added a comment.
Herald added subscribers: pcwang-thead, luke957.
Herald added a project: All.

@mbenfield found false positive

  void test(void) {
static int counter = 0;
counter += 5;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[Lldb-commits] [PATCH] D121078: Replace links to archived mailing lists by links to Discourse forums

2022-03-28 Thread Aaron Ballman via Phabricator via lldb-commits
aaron.ballman added a comment.

In D121078#3400810 , @SimplyDanny 
wrote:

> @tonic, can you please have another look?

If @tonic has any additional feedback, we can handle it post-commit at this 
point. I've gone ahead and committed this on your behalf in 
a749e3295df4aee18a0ad723875a6501f30ac744 
.

(Note, I can't close this review because of the "changes requested" state for 
tonic.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121078

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


[Lldb-commits] [PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2022-03-28 Thread Dávid Bolvanský via Phabricator via lldb-commits
xbolva00 added a comment.

In D100581#3404624 , @xbolva00 wrote:

> @mbenfield found false positive
>
>   void test(void) {
> static int counter = 0;
> counter += 5;
>   }

posted https://reviews.llvm.org/D122374


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[Lldb-commits] [PATCH] D122461: [lldb] Add a fuzzer for target create

2022-03-28 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked an inline comment as done.
Closed by commit rG61efe14e21b2: [lldb] Add a fuzzer for target creation 
(authored by JDevlieghere).
Herald added projects: LLDB, LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D122461?vs=418133&id=418252#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122461

Files:
  lldb/tools/CMakeLists.txt
  lldb/tools/lldb-fuzzer/CMakeLists.txt
  lldb/tools/lldb-fuzzer/lldb-target-fuzzer.cpp
  lldb/tools/lldb-fuzzer/utils/CMakeLists.txt
  lldb/tools/lldb-fuzzer/utils/TempFile.cpp
  lldb/tools/lldb-fuzzer/utils/TempFile.h
  llvm/docs/FuzzingLLVM.rst

Index: llvm/docs/FuzzingLLVM.rst
===
--- llvm/docs/FuzzingLLVM.rst
+++ llvm/docs/FuzzingLLVM.rst
@@ -158,6 +158,11 @@
 .. |LLVM IR fuzzer|
replace:: :ref:`structured LLVM IR fuzzer `
 
+lldb-target-fuzzer
+-
+
+A |generic fuzzer| that interprets inputs as object files and uses them to
+create a target in lldb.
 
 Mutators and Input Generators
 =
Index: lldb/tools/lldb-fuzzer/utils/TempFile.h
===
--- /dev/null
+++ lldb/tools/lldb-fuzzer/utils/TempFile.h
@@ -0,0 +1,27 @@
+//===-- TempFile.h --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+
+namespace lldb_fuzzer {
+
+class TempFile {
+public:
+  TempFile() = default;
+  ~TempFile();
+
+  static std::unique_ptr Create(uint8_t *data, size_t size);
+  llvm::StringRef GetPath() { return m_path.str(); }
+
+private:
+  llvm::SmallString<128> m_path;
+};
+
+} // namespace lldb_fuzzer
Index: lldb/tools/lldb-fuzzer/utils/TempFile.cpp
===
--- /dev/null
+++ lldb/tools/lldb-fuzzer/utils/TempFile.cpp
@@ -0,0 +1,33 @@
+//===-- TempFile.cpp --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "llvm/Support/FileSystem.h"
+#include 
+
+using namespace lldb_fuzzer;
+using namespace llvm;
+
+TempFile::~TempFile() {
+  if (!m_path.empty())
+sys::fs::remove(m_path.str(), true);
+}
+
+std::unique_ptr TempFile::Create(uint8_t *data, size_t size) {
+  int fd;
+  std::unique_ptr temp_file = std::make_unique();
+  std::error_code ec = sys::fs::createTemporaryFile("lldb-fuzzer", "input", fd,
+temp_file->m_path);
+  if (ec)
+return nullptr;
+
+  raw_fd_ostream os(fd, true);
+  os.write(reinterpret_cast(data), size);
+  os.close();
+
+  return temp_file;
+}
Index: lldb/tools/lldb-fuzzer/utils/CMakeLists.txt
===
--- /dev/null
+++ lldb/tools/lldb-fuzzer/utils/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_lldb_library(lldbFuzzerUtils
+  TempFile.cpp
+
+  LINK_COMPONENTS
+Support
+  )
Index: lldb/tools/lldb-fuzzer/lldb-target-fuzzer.cpp
===
--- /dev/null
+++ lldb/tools/lldb-fuzzer/lldb-target-fuzzer.cpp
@@ -0,0 +1,35 @@
+//===-- lldb-target-fuzzer.cpp - Fuzz target creation -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include 
+
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+
+using namespace lldb;
+using namespace lldb_fuzzer;
+using namespace llvm;
+
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
+  SBDebugger::Initialize();
+  return 0;
+}
+
+extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
+  std::unique_ptr file = TempFile::Create(data, size);
+  if (!file)
+return 1;
+
+  SBDebugger debugger = SBDebugger::Create(false);
+  SBTarget target = debugger.CreateTarget(file->GetPath().data());
+  debugger.DeleteTarget(target);
+  SBDebugger::Destroy(debugger);
+  SBModule::GarbageCollectAllocatedModules();
+
+  return 0;
+}
Index: lldb/t

[Lldb-commits] [PATCH] D121631: Introduce new symbol on-demand for debug info

2022-03-28 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan updated this revision to Diff 418632.
yinghuitan added a comment.

Add documentation for the feature.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121631

Files:
  lldb/docs/use/ondemand.rst
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolFileOnDemand.h
  lldb/include/lldb/Target/Statistics.h
  lldb/include/lldb/Utility/LLDBLog.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/SymbolFileOnDemand.cpp
  lldb/source/Target/Statistics.cpp
  lldb/source/Utility/LLDBLog.cpp
  lldb/test/API/symbol_ondemand/breakpoint_language/Makefile
  lldb/test/API/symbol_ondemand/breakpoint_language/TestBreakpointLanguage.py
  lldb/test/API/symbol_ondemand/breakpoint_language/c_lang.c
  lldb/test/API/symbol_ondemand/breakpoint_language/cpp_lang.cpp
  lldb/test/API/symbol_ondemand/breakpoint_language/main.cpp
  lldb/test/API/symbol_ondemand/breakpoint_source_regex/Makefile
  
lldb/test/API/symbol_ondemand/breakpoint_source_regex/TestSourceTextRegexBreakpoint.py
  lldb/test/API/symbol_ondemand/breakpoint_source_regex/main.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/basic.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/lib.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/lib.h
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/shared.cpp
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib-globals-hydration.test
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib-globals.test
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
  lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
  lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test

Index: lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test
@@ -0,0 +1,24 @@
+
+# Test shows that symbolic function breakpoint works with LLDB on demand symbol loading.
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %build %p/Inputs/basic.cpp -o basic.out
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s basic.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+b bar
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+breakpoint list
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+run
+# CHECK: stop reason = breakpoint
+
+bt
+# CHECK: {{.*}}`bar(x=33, y=78) at basic.cpp:1
+# CHECK: {{.*}}`foo(x=33, y=78) at basic.cpp:3
+# CHECK: {{.*}}`main(argc=1, argv={{.*}}) at basic.cpp:5
Index: lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
@@ -0,0 +1,23 @@
+# Test shows that source line breakpoint works with LLDB on demand symbol loading.
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %build %p/Inputs/basic.cpp -o basic.out
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s basic.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+breakpoint set -f basic.cpp -l 1
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+breakpoint list
+# CHECK: file = 'basic.cpp'
+
+run
+# CHECK: stop reason = breakpoint
+
+bt
+# CHECK: {{.*}}`bar(x=33, y=78) at basic.cpp:1
+# CHECK: {{.*}}`foo(x=33, y=78) at basic.cpp:3
+# CHECK: {{.*}}`main(argc=1, argv={{.*}}) at basic.cpp:5
Index: lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
@@ -0,0 +1,37 @@
+# Test shows that source line breakpoint works in multiple shared libraries with LLDB on demand symbol loading.
+
+# REQUIRES: system-linux
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %clang_host -shared -g -fpic %p/Inputs/lib.cpp -o libFoo.so
+# RUN: %clang_host -L%t -g -o shared.out %p/Inputs/shared.cpp -lFoo -Wl,-rpath=%t
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s shared.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+breakpoint set -f lib.cpp -l 4
+# CHECK: where = {{.*}}`foo() + {{.*}} at lib.cpp:4
+
+breakpoint list
+# CHECK: file = 'lib.cpp', line = 4
+
+run
+# CHECK: stop reason = breakpoint
+# CHECK: foo() at lib.cpp:4
+
+bt
+# CHECK: {{.*}}`foo() at lib.cpp:4
+# CHECK: at shared.cpp:7
+
+breakpoint set -f shared.cpp -l 8
+# CHECK: at shared.cpp:8
+
+breakpoint list
+# CHECK: file = 'lib.cpp', line = 4
+# CHECK: file = 'shared.cpp', line = 8
+
+continue
+# CHECK: stop reason = bre

[Lldb-commits] [PATCH] D122603: [wip][intelpt] Refactor timestamps out of `IntelPTInstruction`

2022-03-28 Thread Alisamar Husain via Phabricator via lldb-commits
zrthxn created this revision.
zrthxn added reviewers: wallace, jj10306.
Herald added a project: All.
zrthxn 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/D122603

Files:
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h

Index: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
===
--- lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
+++ lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
@@ -42,6 +42,8 @@
   DecodedThreadSP m_decoded_thread_sp;
   /// Internal instruction index currently pointing at.
   size_t m_pos;
+  /// Current instruction timestamp.
+  uint64_t m_currentts;
 };
 
 } // namespace trace_intel_pt
Index: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
===
--- lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
+++ lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
@@ -74,7 +74,7 @@
 }
 
 bool TraceCursorIntelPT::IsError() {
-  return m_decoded_thread_sp->GetInstructions()[m_pos].IsError();
+  return m_decoded_thread_sp->GetInstructionIsError(m_pos);
 }
 
 const char *TraceCursorIntelPT::GetError() {
@@ -88,7 +88,8 @@
 Optional TraceCursorIntelPT::GetCounter(lldb::TraceCounter counter_type) {
   switch (counter_type) {
 case lldb::eTraceCounterTSC:
-  return m_decoded_thread_sp->GetInstructions()[m_pos].GetTimestampCounter();
+  // Hack to satisfy the the type of inherited member function
+  return Optional(m_decoded_thread_sp->GetInstructionTimestamp(m_pos));
   }
 }
 
Index: lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
===
--- lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
+++ lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
@@ -150,7 +150,8 @@
 // was enabled.
 decoded_thread_sp->AppendInstruction(insn);
   } else {
-decoded_thread_sp->AppendInstruction(insn, time);
+decoded_thread_sp->AppendInstruction(insn);
+decoded_thread_sp->AppendInstructionTimestamp(time);
   }
 }
   }
Index: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
===
--- lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
+++ lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
@@ -62,9 +62,6 @@
 /// As mentioned, any gap is represented as an error in this class.
 class IntelPTInstruction {
 public:
-  IntelPTInstruction(const pt_insn &pt_insn, uint64_t timestamp)
-  : m_pt_insn(pt_insn), m_timestamp(timestamp), m_is_error(false) {}
-
   IntelPTInstruction(const pt_insn &pt_insn)
   : m_pt_insn(pt_insn), m_is_error(false) {}
 
@@ -85,13 +82,6 @@
   /// Get the size in bytes of an instance of this class
   static size_t GetMemoryUsage();
 
-  /// Get the timestamp associated with the current instruction. The timestamp
-  /// is similar to what a rdtsc instruction would return.
-  ///
-  /// \return
-  /// The timestamp or \b llvm::None if not available.
-  llvm::Optional GetTimestampCounter() const;
-
   /// Get the \a lldb::TraceInstructionControlFlowType categories of the
   /// instruction.
   ///
@@ -113,7 +103,6 @@
   // When adding new members to this class, make sure to update
   // IntelPTInstruction::GetNonErrorMemoryUsage() if needed.
   pt_insn m_pt_insn;
-  llvm::Optional m_timestamp;
   bool m_is_error;
 };
 
@@ -131,6 +120,15 @@
   /// Utility constructor that initializes the trace with a provided error.
   DecodedThread(lldb::ThreadSP thread_sp, llvm::Error &&err);
 
+  /// Append a successfully decoded instruction.
+  void AppendInstruction(pt_insn instruction);
+
+  /// Append a timestamp at the index of the last instruction.
+  void AppendInstructionTimestamp(uint64_t timestamp);
+
+  /// Append a decoding error (i.e. an instruction that failed to be decoded).
+  void AppendError(llvm::Error &&error);
+
   /// Get the instructions from the decoded trace. Some of them might indicate
   /// errors (i.e. gaps) in the trace. For an instruction error, you can access
   /// its underlying error message with the \a GetErrorByInstructionIndex()
@@ -140,20 +138,21 @@
   ///   The instructions of the trace.
   llvm::ArrayRef GetInstructions() const;
 
+  /// Get timestamp of an instruction by its index.
+  uint64_t GetInstructionTimestamp(size_t index) const;
+
+  /// Check if the instruction at a given index was an error. 
+  /// -- Reasoning (this will be removed before committing)
+  /// This is faster and less wasteful of memory than creating an ArrayRef 
+  /// every t

[Lldb-commits] [PATCH] D122603: [wip][intelpt] Refactor timestamps out of `IntelPTInstruction`

2022-03-28 Thread Alisamar Husain via Phabricator via lldb-commits
zrthxn updated this revision to Diff 418660.
zrthxn added a comment.

Update cursor timestamp when we have a new one


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122603

Files:
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h

Index: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
===
--- lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
+++ lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
@@ -42,6 +42,8 @@
   DecodedThreadSP m_decoded_thread_sp;
   /// Internal instruction index currently pointing at.
   size_t m_pos;
+  /// Current instruction timestamp.
+  uint64_t m_currentts;
 };
 
 } // namespace trace_intel_pt
Index: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
===
--- lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
+++ lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
@@ -40,6 +40,8 @@
 
   while (canMoveOne()) {
 m_pos += IsForwards() ? 1 : -1;
+if (uint64_t ts = m_decoded_thread_sp->GetInstructionTimestamp(m_pos) != 0)
+  m_currentts = ts;
 if (!m_ignore_errors && IsError())
   return true;
 if (GetInstructionControlFlowType() & m_granularity)
@@ -74,7 +76,7 @@
 }
 
 bool TraceCursorIntelPT::IsError() {
-  return m_decoded_thread_sp->GetInstructions()[m_pos].IsError();
+  return m_decoded_thread_sp->GetInstructionIsError(m_pos);
 }
 
 const char *TraceCursorIntelPT::GetError() {
@@ -88,7 +90,8 @@
 Optional TraceCursorIntelPT::GetCounter(lldb::TraceCounter counter_type) {
   switch (counter_type) {
 case lldb::eTraceCounterTSC:
-  return m_decoded_thread_sp->GetInstructions()[m_pos].GetTimestampCounter();
+  // Hack to satisfy the the type of inherited member function
+  return Optional(m_decoded_thread_sp->GetInstructionTimestamp(m_pos));
   }
 }
 
Index: lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
===
--- lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
+++ lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
@@ -150,7 +150,8 @@
 // was enabled.
 decoded_thread_sp->AppendInstruction(insn);
   } else {
-decoded_thread_sp->AppendInstruction(insn, time);
+decoded_thread_sp->AppendInstruction(insn);
+decoded_thread_sp->AppendInstructionTimestamp(time);
   }
 }
   }
Index: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
===
--- lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
+++ lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
@@ -62,9 +62,6 @@
 /// As mentioned, any gap is represented as an error in this class.
 class IntelPTInstruction {
 public:
-  IntelPTInstruction(const pt_insn &pt_insn, uint64_t timestamp)
-  : m_pt_insn(pt_insn), m_timestamp(timestamp), m_is_error(false) {}
-
   IntelPTInstruction(const pt_insn &pt_insn)
   : m_pt_insn(pt_insn), m_is_error(false) {}
 
@@ -85,13 +82,6 @@
   /// Get the size in bytes of an instance of this class
   static size_t GetMemoryUsage();
 
-  /// Get the timestamp associated with the current instruction. The timestamp
-  /// is similar to what a rdtsc instruction would return.
-  ///
-  /// \return
-  /// The timestamp or \b llvm::None if not available.
-  llvm::Optional GetTimestampCounter() const;
-
   /// Get the \a lldb::TraceInstructionControlFlowType categories of the
   /// instruction.
   ///
@@ -113,7 +103,6 @@
   // When adding new members to this class, make sure to update
   // IntelPTInstruction::GetNonErrorMemoryUsage() if needed.
   pt_insn m_pt_insn;
-  llvm::Optional m_timestamp;
   bool m_is_error;
 };
 
@@ -131,6 +120,15 @@
   /// Utility constructor that initializes the trace with a provided error.
   DecodedThread(lldb::ThreadSP thread_sp, llvm::Error &&err);
 
+  /// Append a successfully decoded instruction.
+  void AppendInstruction(pt_insn instruction);
+
+  /// Append a timestamp at the index of the last instruction.
+  void AppendInstructionTimestamp(uint64_t timestamp);
+
+  /// Append a decoding error (i.e. an instruction that failed to be decoded).
+  void AppendError(llvm::Error &&error);
+
   /// Get the instructions from the decoded trace. Some of them might indicate
   /// errors (i.e. gaps) in the trace. For an instruction error, you can access
   /// its underlying error message with the \a GetErrorByInstructionIndex()
@@ -140,20 +138,21 @@
   ///   The instructions of the trace.
   llvm::ArrayRef GetInstructions() const;
 
+  /// Get timestamp of an instruction by its inde

[Lldb-commits] [PATCH] D122603: [wip][intelpt] Refactor timestamps out of `IntelPTInstruction`

2022-03-28 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

let's better use the word TSC instead of timestamps, which is more accurate




Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:124
+  /// Append a successfully decoded instruction.
+  void AppendInstruction(pt_insn instruction);
+

receive `const &pt_insn` to avoid copies 



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:126-127
+
+  /// Append a timestamp at the index of the last instruction.
+  void AppendInstructionTimestamp(uint64_t timestamp);
+

Let's just use an overload
  void AppendInstruction(const pt_insn &instruction, uint64_t tsc);



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:141-142
 
+  /// Get timestamp of an instruction by its index.
+  uint64_t GetInstructionTimestamp(size_t index) const;
+

This has to be an optional because it might not be present


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122603

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


[Lldb-commits] [PATCH] D122254: [trace][intelpt] Introduce instruction Ids

2022-03-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Commands/CommandObjectThread.cpp:2201
+// command
+if (cmd.find(" repeat") == std::string::npos)
+  cmd += " repeat";

This " repeat" is pretty hacky here. If we can't get away without adding 
anything, I would prefer the --continue option we had before



Comment at: lldb/source/Commands/CommandObjectThread.cpp:2254-2256
+  m_options.m_dumper_options.skip = 1;
+  m_options.m_dumper_options.id = m_last_id;
 }

to make repeat work, you are filling in the dumper options, can't we just store 
a copy of the old thread options and update the "id" field?

You also mentioned:



> I couldn't find a simple way to create the repeat command directly from 
> GetRepeatCommand because it's not easy to quickly find what the next 
> instruction is going to be in the repeat command. In fact, finding the id of 
> that future instruction requires to actually traverse the instructions up to 
> that point, but the traversal only happens in DoExecute, which is invoked 
> after GetRepeatCommand. As a simple workarou nd, I'm adding a " repeat" 
> positional argument that won't be parsed by CommandOptions but will still 
> indicate that a repeat is happening. I was able to remove the --continue flag 
> from Options.td, thus reducing the amount of code needed to handle the 
> repeat. Not only that, I was able to get rid of the map TraceInstructionDumper> that I had in the CommandObject that I was using to 
> continue the iteration in the repeat commands. Now I'm using the last 
> iterated id to computed where the next one will be, thus creating a new brand 
> new dumper with each command making this class simpler.

You seem to have the right "id" to start at here with m_last_id? Why can't we 
just store this in an extra copy of TraceInstructionDumperOptions and have it 
create the right command?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122254

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


[Lldb-commits] [PATCH] D122603: [wip][intelpt] Refactor timestamps out of `IntelPTInstruction`

2022-03-28 Thread walter erquinigo via Phabricator via lldb-commits
wallace requested changes to this revision.
wallace added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp:94-96
+  auto last_ts = m_instruction_timestamps[m_instruction_timestamps.size() - 1];
+  if (last_ts != time)
+m_instruction_timestamps.emplace(m_instructions.size() - 1, time);

doing [] is O(logn), and we want to be faster than this.

You can do the following which is O(1)

  auto it = m_instruction_timestamps.end()
  if (it != m_instruction_timestamps.begin()) {
it--;
if (it->second != tsc) {
  // this tsc is not the same!
 m_instruction_timestamps.insert(insn_idx, tsc);
} else {
  // this tsc is the same, do nothing
}
  }

you can further optimize this by storing the last tsc that has been appended, 
that way you don't even need to create iterators



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp:109-112
+  auto insn_ts = m_instruction_timestamps.find(index);
+  if (!m_instruction_timestamps.empty() && insn_ts != 
m_instruction_timestamps.end())
+return insn_ts->second;
+  return 0;

this is wrong, you need to use upper_bound - 1, like this:
  
  if (m_instruction_timestamps.empty())
return None;

  auto it = m_instruction_timestamps.upper_bound(insn_idx);
  if (it == m_instruction_timestamps.begin())
return None;

  --it;
  return it->second;
 
this will allow you to go to the largest index that is <= than insn_idx



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:141-142
 
+  /// Get timestamp of an instruction by its index.
+  uint64_t GetInstructionTimestamp(size_t index) const;
+

wallace wrote:
> This has to be an optional because it might not be present
better use insn_idx instead of index for all these variables



Comment at: lldb/source/Plugins/Trace/intel-pt/DecodedThread.h:144-148
+  /// Check if the instruction at a given index was an error. 
+  /// -- Reasoning (this will be removed before committing)
+  /// This is faster and less wasteful of memory than creating an ArrayRef 
+  /// every time that you need to check this, with 
GetInstructions()[i].IsError()
+  bool GetInstructionIsError(size_t insn_idx) const;

I actually like this, let's improve it



Comment at: lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp:153-154
   } else {
-decoded_thread_sp->AppendInstruction(insn, time);
+decoded_thread_sp->AppendInstruction(insn);
+decoded_thread_sp->AppendInstructionTimestamp(time);
   }





Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp:25
  "a trace should have at least one instruction or error");
   m_pos = m_decoded_thread_sp->GetInstructions().size() - 1;
 }

here you need to set the correct value of m_current_tsc



Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp:43-44
 m_pos += IsForwards() ? 1 : -1;
+if (uint64_t ts = m_decoded_thread_sp->GetInstructionTimestamp(m_pos) != 0)
+  m_currentts = ts;
 if (!m_ignore_errors && IsError())

this will be O(logn). We can do better if m_current_tsc is the following little 
structure

class DecodedThread {
  struct TscRange {
size_t start_index;
size_t end_index;
size_t tsc;
std::map::iterator prev;
std::map::iterator next;
  };
}
  Optional m_current_tsc;

Then you can ask the new method `Optional 
DecodedThread::GetTSCRange(size_t insn_index)` which will give you the entire 
range of the tsc that covers insn_index. With these numbers, you can do a 
comparison in this line to very quickly move from TSC to TSC only when needed.

You can also have the method `DecodedThread::GetNextTscRange(const TscRange& 
range)` that computes in O(1) the next range, and you can similarly have 
GetPrevTscRange()`. The iterators will help you do that withing using 
lower_bound, which is O(1)



Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp:75
 return std::abs(dist);
   }
 }

you need to calculate the new tsc_range after moving m_pos



Comment at: lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h:45-46
   size_t m_pos;
+  /// Current instruction timestamp.
+  uint64_t m_currentts;
 };

Optional m_current_tsc;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122603

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


[Lldb-commits] [PATCH] D122254: [trace][intelpt] Introduce instruction Ids

2022-03-28 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 418680.
wallace added a comment.

- Bring back the --continue command.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122254

Files:
  lldb/include/lldb/Target/TraceCursor.h
  lldb/include/lldb/Target/TraceInstructionDumper.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  lldb/source/Target/TraceInstructionDumper.cpp
  lldb/test/API/commands/trace/TestTraceDumpInstructions.py
  lldb/test/API/commands/trace/TestTraceStartStop.py
  lldb/test/API/commands/trace/TestTraceTimestampCounters.py

Index: lldb/test/API/commands/trace/TestTraceTimestampCounters.py
===
--- lldb/test/API/commands/trace/TestTraceTimestampCounters.py
+++ lldb/test/API/commands/trace/TestTraceTimestampCounters.py
@@ -19,7 +19,7 @@
 
 self.expect("n")
 self.expect("thread trace dump instructions --tsc -c 1",
-patterns=["\[0\] \[tsc=0x[0-9a-fA-F]+\] 0x00400511movl"])
+patterns=["0: \[tsc=0x[0-9a-fA-F]+\] 0x00400511movl"])
 
 @testSBAPIAndCommands
 @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
@@ -32,7 +32,7 @@
 
 self.expect("n")
 self.expect("thread trace dump instructions --tsc -c 1",
-patterns=["\[0\] \[tsc=0x[0-9a-fA-F]+\] 0x00400511movl"])
+patterns=["0: \[tsc=0x[0-9a-fA-F]+\] 0x00400511movl"])
 
 @testSBAPIAndCommands
 @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
@@ -45,7 +45,7 @@
 
 self.expect("n")
 self.expect("thread trace dump instructions --tsc -c 1",
-patterns=["\[0\] \[tsc=unavailable\] 0x00400511movl"])
+patterns=["0: \[tsc=unavailable\] 0x00400511movl"])
 
 @testSBAPIAndCommands
 @skipIf(oslist=no_match(['linux']), archs=no_match(['i386', 'x86_64']))
Index: lldb/test/API/commands/trace/TestTraceStartStop.py
===
--- lldb/test/API/commands/trace/TestTraceStartStop.py
+++ lldb/test/API/commands/trace/TestTraceStartStop.py
@@ -114,29 +114,29 @@
 self.expect("thread trace dump instructions -f",
 patterns=[f'''thread #1: tid = .*
   a.out`main \+ 4 at main.cpp:2
-\[ 0\] {ADDRESS_REGEX}movl'''])
+0: {ADDRESS_REGEX}movl'''])
 
 # We can reconstruct the instructions up to the second line
 self.expect("n")
 self.expect("thread trace dump instructions -f",
 patterns=[f'''thread #1: tid = .*
   a.out`main \+ 4 at main.cpp:2
-\[ 0\] {ADDRESS_REGEX}movl .*
+0: {ADDRESS_REGEX}movl .*
   a.out`main \+ 11 at main.cpp:4
-\[ 1\] {ADDRESS_REGEX}movl .*
-\[ 2\] {ADDRESS_REGEX}jmp  .* ; <\+28> at main.cpp:4
-\[ 3\] {ADDRESS_REGEX}cmpl .*
-\[ 4\] {ADDRESS_REGEX}jle  .* ; <\+20> at main.cpp:5'''])
+1: {ADDRESS_REGEX}movl .*
+2: {ADDRESS_REGEX}jmp  .* ; <\+28> at main.cpp:4
+3: {ADDRESS_REGEX}cmpl .*
+4: {ADDRESS_REGEX}jle  .* ; <\+20> at main.cpp:5'''])
 
 self.expect("thread trace dump instructions",
 patterns=[f'''thread #1: tid = .*
   a.out`main \+ 32 at main.cpp:4
-\[  0\] {ADDRESS_REGEX}jle  .* ; <\+20> at main.cpp:5
-\[ -1\] {ADDRESS_REGEX}cmpl .*
-\[ -2\] {ADDRESS_REGEX}jmp  .* ; <\+28> at main.cpp:4
-\[ -3\] {ADDRESS_REGEX}movl .*
+4: {ADDRESS_REGEX}jle  .* ; <\+20> at main.cpp:5
+3: {ADDRESS_REGEX}cmpl .*
+2: {ADDRESS_REGEX}jmp  .* ; <\+28> at main.cpp:4
+1: {ADDRESS_REGEX}movl .*
   a.out`main \+ 4 at main.cpp:2
-\[ -4\] {ADDRESS_REGEX}movl .* '''])
+0: {ADDRESS_REGEX}movl .* '''])
 
 # We stop tracing
 self.expect("thread trace stop")
@@ -152,12 +152,12 @@
 self.expect("thread trace dump instructions -f",
 patterns=[f'''thread #1: tid = .*
   a.out`main \+ 20 at main.cpp:5
-\[ 0\] {ADDRESS_REGEX}xorl'''])
+0: {ADDRESS_REGEX}xorl'''])
 
 self.expect("thread trace dump instructions",
 patterns=[f'''thread #1: tid = .*
   a.out`main \+ 20 at main.cpp:5
-\[  0\] {ADDRESS_REGEX}xorl'''])
+0: {ADDRESS_REGEX}xorl'''])
 
 self.expect("c")
 # Now the process has finished, so the commands should fail
Index: lldb/test/API/commands/trace/TestTraceDumpInstructions.py
===
--- lldb/test/API/commands/trace/TestTraceDumpInstructions.py
+++ lldb/test/API/commands/trace/TestTraceDumpInstructions.py
@@ -37,49 +37,67 @@
 
 

[Lldb-commits] [PATCH] D121631: Introduce new symbol on-demand for debug info

2022-03-28 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan updated this revision to Diff 418708.
yinghuitan added a comment.

Fix log channel typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121631

Files:
  lldb/docs/use/ondemand.rst
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolFileOnDemand.h
  lldb/include/lldb/Target/Statistics.h
  lldb/include/lldb/Utility/LLDBLog.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/SymbolFileOnDemand.cpp
  lldb/source/Target/Statistics.cpp
  lldb/source/Utility/LLDBLog.cpp
  lldb/test/API/symbol_ondemand/breakpoint_language/Makefile
  lldb/test/API/symbol_ondemand/breakpoint_language/TestBreakpointLanguage.py
  lldb/test/API/symbol_ondemand/breakpoint_language/c_lang.c
  lldb/test/API/symbol_ondemand/breakpoint_language/cpp_lang.cpp
  lldb/test/API/symbol_ondemand/breakpoint_language/main.cpp
  lldb/test/API/symbol_ondemand/breakpoint_source_regex/Makefile
  
lldb/test/API/symbol_ondemand/breakpoint_source_regex/TestSourceTextRegexBreakpoint.py
  lldb/test/API/symbol_ondemand/breakpoint_source_regex/main.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/basic.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/lib.cpp
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/lib.h
  lldb/test/Shell/SymbolFile/OnDemand/Inputs/shared.cpp
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib-globals-hydration.test
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib-globals.test
  lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
  lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
  lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test

Index: lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/symbolic-breakpoint.test
@@ -0,0 +1,24 @@
+
+# Test shows that symbolic function breakpoint works with LLDB on demand symbol loading.
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %build %p/Inputs/basic.cpp -o basic.out
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s basic.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+b bar
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+breakpoint list
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+run
+# CHECK: stop reason = breakpoint
+
+bt
+# CHECK: {{.*}}`bar(x=33, y=78) at basic.cpp:1
+# CHECK: {{.*}}`foo(x=33, y=78) at basic.cpp:3
+# CHECK: {{.*}}`main(argc=1, argv={{.*}}) at basic.cpp:5
Index: lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/source-breakpoint.test
@@ -0,0 +1,23 @@
+# Test shows that source line breakpoint works with LLDB on demand symbol loading.
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %build %p/Inputs/basic.cpp -o basic.out
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s basic.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+breakpoint set -f basic.cpp -l 1
+# CHECK: where = {{.*}}`bar(int, int) + {{.*}} at basic.cpp:1
+
+breakpoint list
+# CHECK: file = 'basic.cpp'
+
+run
+# CHECK: stop reason = breakpoint
+
+bt
+# CHECK: {{.*}}`bar(x=33, y=78) at basic.cpp:1
+# CHECK: {{.*}}`foo(x=33, y=78) at basic.cpp:3
+# CHECK: {{.*}}`main(argc=1, argv={{.*}}) at basic.cpp:5
Index: lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/OnDemand/shared-lib.test
@@ -0,0 +1,37 @@
+# Test shows that source line breakpoint works in multiple shared libraries with LLDB on demand symbol loading.
+
+# REQUIRES: system-linux
+
+# RUN: mkdir -p %t
+# RUN: cd %t
+# RUN: %clang_host -shared -g -fpic %p/Inputs/lib.cpp -o libFoo.so
+# RUN: %clang_host -L%t -g -o shared.out %p/Inputs/shared.cpp -lFoo -Wl,-rpath=%t
+# RUN: %lldb -b -O "settings set symbols.load-on-demand true" -s %s shared.out | FileCheck %s
+
+breakpoint list
+# CHECK: No breakpoints currently set
+
+breakpoint set -f lib.cpp -l 4
+# CHECK: where = {{.*}}`foo() + {{.*}} at lib.cpp:4
+
+breakpoint list
+# CHECK: file = 'lib.cpp', line = 4
+
+run
+# CHECK: stop reason = breakpoint
+# CHECK: foo() at lib.cpp:4
+
+bt
+# CHECK: {{.*}}`foo() at lib.cpp:4
+# CHECK: at shared.cpp:7
+
+breakpoint set -f shared.cpp -l 8
+# CHECK: at shared.cpp:8
+
+breakpoint list
+# CHECK: file = 'lib.cpp', line = 4
+# CHECK: file = 'shared.cpp', line = 8
+
+continue
+# CHECK: stop reason = breakpoint
+# CHE

[Lldb-commits] [lldb] 42d3d71 - Silence compiler warning after the addition of HLSL to Clang

2022-03-28 Thread Benjamin Kramer via lldb-commits

Author: Benjamin Kramer
Date: 2022-03-29T01:23:20+02:00
New Revision: 42d3d717b8140cb0ef2169d1ac25f0f166cd61bf

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

LOG: Silence compiler warning after the addition of HLSL to Clang

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:472:16: warning: 
enumeration value 'HLSL' not handled in switch [-Wswitch]
switch (IK.getLanguage()) {
   ^

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 2d5bd02febe54..019cb0c1b8449 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -495,6 +495,9 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, 
const char *triple) {
 case clang::Language::HIP:
   LangStd = LangStandard::lang_hip;
   break;
+case clang::Language::HLSL:
+  LangStd = LangStandard::lang_hlsl;
+  break;
 }
   }
 



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


[Lldb-commits] [PATCH] D122621: Add missing case `HLSL` to `ParseLangArgs` in `TypeSystemClang.cpp`

2022-03-28 Thread Frederik Gossen via Phabricator via lldb-commits
frgossen created this revision.
frgossen added a reviewer: beanz.
Herald added a project: All.
frgossen 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/D122621

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
@@ -472,6 +472,7 @@
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
 case clang::Language::LLVM_IR:
+case clang::Language::HLSL:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");
 case clang::Language::OpenCL:


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -472,6 +472,7 @@
 switch (IK.getLanguage()) {
 case clang::Language::Unknown:
 case clang::Language::LLVM_IR:
+case clang::Language::HLSL:
 case clang::Language::RenderScript:
   llvm_unreachable("Invalid input kind!");
 case clang::Language::OpenCL:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D122568: [lldb] correct comment in deterministic build test

2022-03-28 Thread Jez Ng via Phabricator via lldb-commits
int3 added a comment.

The underlying test is still using just ld64 though. I think a proper fix be to 
use LLD if it's available as the host linker?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122568

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