[Lldb-commits] [lldb] [llvm-lit][test] Change unsupported cat -e to cat -v to work with lit internal shell (PR #104878)

2024-08-20 Thread James Henderson via lldb-commits

https://github.com/jh7370 commented:

Looks reasonable to me, but I think it would be worth highlighting in the text 
the difference between -e and -v, so that people doing code archaelogy don't 
have to look up cat options.

Probably should get an lldb maintainer to approve though.

https://github.com/llvm/llvm-project/pull/104878
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -600,6 +600,14 @@ StringRef extension(StringRef path, Style style) {
   return fname.substr(pos);
 }
 
+StringRef program_name(StringRef path, Style style) {
+  // In the future this may need to be extended to other
+  // program suffixes.

jh7370 wrote:

Unnecessarily wrapped.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -1696,6 +1696,38 @@ TEST(Support, ReplacePathPrefix) {
   EXPECT_EQ(Path, "C:\\old/foo\\bar");
 }
 
+TEST(Support, FindProgramName) {
+  StringRef WindowsProgName =
+  path::program_name("C:\\Test\\foo.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgName, "foo");
+
+  StringRef WindowsProgNameManyDots = path::program_name(
+  "C:\\Test.7\\x86_64-freebsd14.0-clang.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgNameManyDots, "x86_64-freebsd14.0-clang");
+
+  StringRef PosixProgName =
+  path::program_name("/var/empty/clang.exe", path::Style::posix);
+  EXPECT_EQ(PosixProgName, "clang");
+
+  StringRef PosixProgNameManyDotsExe = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.exe",
+  path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDotsExe, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameManyDots = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar", path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDots, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameSh =
+  
path::program_name("/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.sh",
+ path::Style::posix);
+  EXPECT_EQ(PosixProgNameSh, "x86_64-portbld-freebsd13.2-llvm-ar.sh");
+
+  StringRef WorseThanFailure =

jh7370 wrote:

`WorseThanFailure` doesn't describe the case particularly well, especially as 
the behaviour here is the same as `stem`. Could it simply be `OnlyExe`?

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -5,16 +5,22 @@
 # RUN: mkdir %t
 # RUN: ln -s llvm-ar %t/llvm-ar-9
 # RUN: ln -s llvm-ar %t/ar.exe
+# RUN: ln -s llvm-ar %t/x86_64-portbld-freebsd13.2-llvm-ar
+# RUN: ln -s llvm-ar %t/x86_64-portbld-freebsd13.2-llvm-ar.exe
 # RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9
 
 # RUN: llvm-ar h | FileCheck %s --check-prefix=DEFAULT
 # RUN: %t/llvm-ar-9 h | FileCheck %s --check-prefix=VERSION
 # RUN: %t/ar.exe h | FileCheck %s --check-prefix=SUFFIX
+# RUN: %t/x86_64-portbld-freebsd13.2-llvm-ar h | FileCheck %s 
--check-prefix=TARGETDOT
+# RUN: %t/x86_64-portbld-freebsd13.2-llvm-ar.exe h | FileCheck %s 
--check-prefix=MULTIDOT
 ## Ensure that the "lib" substring does not result in misidentification as the
 ## llvm-lib tool.
 # RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s 
--check-prefix=ARM
 
 # DEFAULT: USAGE: llvm-ar{{ }}
 # VERSION: USAGE: llvm-ar-9{{ }}
 # SUFFIX: USAGE: ar{{ }}
+# TARGETDOT: USAGE: x86_64-portbld-freebsd13.2-llvm-ar{{ }}
+# MULTIDOT: USAGE: x86_64-portbld-freebsd13.2-llvm-ar{{ }}

jh7370 wrote:

These don't need to be separate CHECK patterns, as they check the same thing. 
Simply reuse the prefix and only have one of them.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-18 Thread James Henderson via lldb-commits


@@ -390,6 +390,21 @@ StringRef stem(StringRef path, Style style = 
Style::native);
 /// @result The extension of \a path.
 StringRef extension(StringRef path, Style style = Style::native);
 
+/// Get the program's name
+///
+/// If the path ends with the string .exe, returns the stem of
+/// \a path. Otherwise returns the filename of \a path.
+///
+/// @code
+///   /foo/prog.exe => prog
+///   /bar/prog => prog
+///   /foo/prog1.2  => prog1.2
+/// @endcode
+///
+/// @param path Input path.
+/// @result The filename of \a path. Without any .exe component

jh7370 wrote:

```suggestion
/// @result The filename of \a path without any ".exe" component.
```

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-19 Thread James Henderson via lldb-commits

https://github.com/jh7370 approved this pull request.

Force pushing (and therefore rebasing) is [supposed to be 
avoided](https://llvm.org/docs/GitHub.html#rebasing-pull-requests-and-force-pushes)
 unless it's absolutely necessary. Was a rebase actually required for this 
change? One of the motivations to avoid force pushes is that I can no longer 
see what changed versus my previous review, which is a fairly major usability 
issue for reviewing. Fortunately, this is a small review...

By the way, did you mean to have two commits in your PR?

LGTM, aside from a comment on the TODO.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-19 Thread James Henderson via lldb-commits


@@ -5,11 +5,14 @@
 # RUN: mkdir %t
 # RUN: ln -s llvm-ranlib %t/llvm-ranlib-9
 # RUN: ln -s llvm-ranlib %t/ranlib.exe
+# RUN: ln -s llvm-ranlib %t/x86_64-unknown-freebsd13.2-llvm-ranlib

jh7370 wrote:

Let's put the new test files and deletion of this old test in a different PR. 
The old code was untested, so we're not making things worse, but it also helps 
keep the PRs focused. Aside: if we're deleting this old file, I think it would 
be a good idea to add one or two cases to the llvm-ar test showing the 
"llvm-ranlib" name.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-09-19 Thread James Henderson via lldb-commits


@@ -1696,6 +1696,40 @@ TEST(Support, ReplacePathPrefix) {
   EXPECT_EQ(Path, "C:\\old/foo\\bar");
 }
 
+TEST(Support, FindProgramName) {
+  StringRef WindowsProgName =
+  path::program_name("C:\\Test\\foo.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgName, "foo");
+
+  StringRef WindowsProgNameManyDots = path::program_name(
+  "C:\\Test.7\\x86_64-freebsd14.0-clang.exe", path::Style::windows);
+  EXPECT_EQ(WindowsProgNameManyDots, "x86_64-freebsd14.0-clang");
+
+  StringRef PosixProgName =
+  path::program_name("/var/empty/clang.exe", path::Style::posix);
+  EXPECT_EQ(PosixProgName, "clang");
+
+  StringRef PosixProgNameManyDotsExe = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.exe",
+  path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDotsExe, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameManyDots = path::program_name(
+  "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar", path::Style::posix);
+  EXPECT_EQ(PosixProgNameManyDots, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+  StringRef PosixProgNameSh =
+  
path::program_name("/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.sh",
+ path::Style::posix);
+  EXPECT_EQ(PosixProgNameSh, "x86_64-portbld-freebsd13.2-llvm-ar.sh");
+
+  // TODO: determine if this is correct. What happens on windows with an 
executable
+  // named ".exe"?

jh7370 wrote:

I just used the Windows UI to rename a file to ".exe" and it works fine (both 
renaming and susbequent execution of the file from the command-line). 
Meanwhile, the documented behaviour of `stem` is that something containing only 
a single dot will result in an empty string, which I think we should be 
mirroring here. I think the behaviour tested here is therefore correct and you 
can probably drop the TODO note.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [RFC][LLDB] Telemetry in LLDB (PR #87815)

2024-04-08 Thread James Henderson via lldb-commits


@@ -0,0 +1,237 @@
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+using SteadyTimePoint = std::chrono::time_point;

jh7370 wrote:

Speaking from experience: `steady_clock` is only useful for measuring 
durations, since it isn't relative to a user's (or indeed any) fixed point in 
time - try converting it to a year/month/day etc format and you'll see what I 
mean. If you want an actual point in time that can be understood by the 
telemetry consumer, you'll need something to act as the base point of time that 
the steady times are relative to. In our internal telemetry implementation, our 
duration events therefore actually use both steady and system clock time 
points, with the reported duration being the difference between two steady time 
points, and the system clock time point being to indicate when the event was 
triggered.

https://github.com/llvm/llvm-project/pull/87815
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [RFC][LLDB] Telemetry in LLDB (PR #87815)

2024-04-08 Thread James Henderson via lldb-commits

https://github.com/jh7370 edited https://github.com/llvm/llvm-project/pull/87815
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [RFC][LLDB] Telemetry in LLDB (PR #87815)

2024-04-08 Thread James Henderson via lldb-commits


@@ -0,0 +1,237 @@
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+using SteadyTimePoint = std::chrono::time_point;
+
+struct TelemetryEventStats {
+  // REQUIRED: Start time of event
+  SteadyTimePoint m_start;
+  // OPTIONAL: End time of event - may be empty if not meaningful.
+  std::optional m_end;
+
+  // TBD: could add some memory stats here too?
+
+  TelemetryEventStats() = default;
+  TelemetryEventStats(SteadyTimePoint start) : m_start(start) {}
+  TelemetryEventStats(SteadyTimePoint start, SteadyTimePoint end)
+  : m_start(start), m_end(end) {}
+
+  std::optional Duration() const {
+if (m_end.has_value())
+  return *m_end - m_start;
+else
+  return std::nullopt;
+  }
+};
+
+struct LoggerConfig {
+  // If true, loggings will be enabled.
+  bool enable_logging;
+
+  // Additional destinations to send the logged entries.
+  // Could be stdout, stderr, or some local paths.
+  // Note: these are destinations are __in addition to__ whatever the default
+  // destination(s) are, as implemented by vendors.
+  std::vector additional_destinations;
+};
+
+// The base class contains the basic set of data.
+// Downstream implementations can add more fields as needed.
+struct BaseTelemetryEntry {
+  // A "session" corresponds to every time lldb starts.
+  // All entries emitted for the same session will have
+  // the same session_uuid
+  std::string session_uuid;
+
+  TelemetryEventStats stats;

jh7370 wrote:

+1: duration-style events are just one kind of event in our downstream 
telemetry system. It doesn't make sense for most events to have a duration 
though, so we have many other kinds of events (e.g. feature usage events).

https://github.com/llvm/llvm-project/pull/87815
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [RFC][LLDB] Telemetry in LLDB (PR #87815)

2024-04-08 Thread James Henderson via lldb-commits

https://github.com/jh7370 commented:

As I think I mentioned in the original RFC, I'm not convinced the core 
functionality for this belongs in LLDB. In my view, LLDB is a client that 
should make use of a common telemetry library that can be used by other parts 
of the wider LLVM toolchain, or indeed other non-LLVM tools. From a point of 
view of separation of concerns, it also doesn't make sense: LLDB is for 
debugging, whereas telemetry is a more generic thing that isn't specific to 
debugging. Certainly, there may be some specific aspects that are tied to LLDB 
in particular, but I'd expect those to be about the "what" is reported, not the 
"how" it is reported.

As others have mentioned, I think it would be really helpful to have an 
overview of the design with the different key parts described (by class name 
ideally), preferably with the aid of a diagram, since a picture is often a 
clearer way of describing structure than words are.

https://github.com/llvm/llvm-project/pull/87815
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-23 Thread James Henderson via lldb-commits

jh7370 wrote:

> This looks like a nice improvement for folks using those generators. Even 
> though most of these changes look straightforward, it would be a lot easier 
> to review if this was broken up per subproject. Is there any reason that's 
> not possible?

+1 to this: 195 files is too many to review in a single PR really, so if we 
have an alternative, incremental approach, we should take that. (Also big +1 to 
the improvement though).

https://github.com/llvm/llvm-project/pull/89153
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [openmp] [libc] [libcxx] [libclc] [lld] [lldb] [clang-tools-extra] [compiler-rt] [clang] [llvm] Make llvm-strip not eat the .gnu_debuglink section (PR #78919)

2024-01-22 Thread James Henderson via lldb-commits

https://github.com/jh7370 requested changes to this pull request.

Hi, thanks for the contribution.

Please could you add a new lit test case to show that this behaviour works as 
intended.

I note that this code as-is only impacts `--strip-all` behaviour. This means 
that if you use `--strip-debug`, the section will get removed. Is this 
intentional? What do GNU strip or objcopy do in these cases?

https://github.com/llvm/llvm-project/pull/78919
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-10-19 Thread James Henderson via lldb-commits

jh7370 wrote:

@dankm, is there a particular reason you haven't merged this change in yet?

FWIW, the formatter check failed for some reason, but I'm not sure it's related 
to any formatting issue. Please verify by running clang-format on your changes 
before merging.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Support target names with dots in more utilities (PR #65812)

2023-10-22 Thread James Henderson via lldb-commits

jh7370 wrote:

I can merge it for you, but first I just want to confirm that all 4 commits in 
this PR are intended to be for the PR? If not, you'll need to rebase and force 
push.

There's no need for you to manually squash the fixups (although you might as 
well if you do end up rebasing). When I do the merge via the UI, it'll be using 
the Squash and merge button, which squashes everything into a single commit.

The final commit message will be the PR description. I found the description a 
little confusing at first, without reading the code and test, so it may be 
beneficial to add an example of the before and after behaviour to that 
description before I merge it. Please could you update the patch description 
accordingly.

https://github.com/llvm/llvm-project/pull/65812
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a1e6565 - [lit] Stop using PATH to lookup clang/lld/lldb unless requested

2021-05-18 Thread James Henderson via lldb-commits

Author: James Henderson
Date: 2021-05-18T10:43:33+01:00
New Revision: a1e6565855784988aa6302d6672705baf2a84ff2

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

LOG: [lit] Stop using PATH to lookup clang/lld/lldb unless requested

This patch stops lit from looking on the PATH for clang, lld and other
users of use_llvm_tool (currently only the debuginfo-tests) unless the
call explicitly requests to opt into using the PATH. When not opting in,
tests will only look in the build directory.

See the mailing list thread starting from
https://lists.llvm.org/pipermail/llvm-dev/2021-May/150421.html.

See the review for details of why decisions were made about when still
to use the PATH.

Reviewed by: thopre

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

Added: 


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

Removed: 




diff  --git a/lldb/test/Shell/helper/toolchain.py 
b/lldb/test/Shell/helper/toolchain.py
index 6e564f31dbd37..6ccb529e89852 100644
--- a/lldb/test/Shell/helper/toolchain.py
+++ b/lldb/test/Shell/helper/toolchain.py
@@ -147,14 +147,14 @@ def use_support_substitutions(config):
 
 
llvm_config.use_clang(additional_flags=['--target=specify-a-target-or-use-a-_host-substitution'],
   additional_tool_dirs=additional_tool_dirs,
-  required=True)
+  required=True, use_installed=True)
 
 
 if sys.platform == 'win32':
 _use_msvc_substitutions(config)
 
 have_lld = llvm_config.use_lld(additional_tool_dirs=additional_tool_dirs,
-   required=False)
+   required=False, use_installed=True)
 if have_lld:
 config.available_features.add('lld')
 

diff  --git a/llvm/utils/lit/lit/llvm/config.py 
b/llvm/utils/lit/lit/llvm/config.py
index 6ff3cba00f3e0..94824cd34773a 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -401,10 +401,11 @@ def use_default_substitutions(self):
 
 self.add_err_msg_substitutions()
 
-def use_llvm_tool(self, name, search_env=None, required=False, 
quiet=False):
+def use_llvm_tool(self, name, search_env=None, required=False, quiet=False,
+  use_installed=False):
 """Find the executable program 'name', optionally using the specified
-environment variable as an override before searching the
-configuration's PATH."""
+environment variable as an override before searching the build 
directory
+and then optionally the configuration's PATH."""
 # If the override is specified in the environment, use it without
 # validation.
 tool = None
@@ -412,7 +413,11 @@ def use_llvm_tool(self, name, search_env=None, 
required=False, quiet=False):
 tool = self.config.environment.get(search_env)
 
 if not tool:
-# Otherwise look in the path.
+# Use the build directory version.
+tool = lit.util.which(name, self.config.llvm_tools_dir)
+
+if not tool and use_installed:
+# Otherwise look in the path, if enabled.
 tool = lit.util.which(name, self.config.environment['PATH'])
 
 if required and not tool:
@@ -429,11 +434,11 @@ def use_llvm_tool(self, name, search_env=None, 
required=False, quiet=False):
 return tool
 
 def use_clang(self, additional_tool_dirs=[], additional_flags=[],
-  required=True):
+  required=True, use_installed=False):
 """Configure the test suite to be able to invoke clang.
 
 Sets up some environment variables important to clang, locates a
-just-built or installed clang, and add a set of standard
+just-built or optionally an installed clang, and add a set of standard
 substitutions useful to any test suite that makes use of clang.
 
 """
@@ -497,7 +502,8 @@ def use_clang(self, additional_tool_dirs=[], 
additional_flags=[],
 
 # Discover the 'clang' and 'clangcc' to use.
 self.config.clang = self.use_llvm_tool(
-'clang', search_env='CLANG', required=required)
+'clang', search_env='CLANG', required=required,
+use_installed=use_installed)
 if self.config.clang:
   self.config.available_features.add('clang')
   builtin_include_dir = self.get_clang_builtin_include_dir(
@@ -569,11 +575,12 @@ def prefer(this, to):
 (' %clang-cl ',
  '''\"*** invalid substitution, use '%clang_cl'. ***\"'''))
 
-def use_lld(self, additional_tool_dirs=[], required=True):
+def use_lld(self, additional_tool_dirs=[], required=True,
+use_instal

[Lldb-commits] [lldb] 7116e43 - [DebugInfo] Make most debug line prologue errors non-fatal to parsing

2020-01-29 Thread James Henderson via lldb-commits

Author: James Henderson
Date: 2020-01-29T10:23:41Z
New Revision: 7116e431c0ab4194907bbaf73482ac05d923787f

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

LOG: [DebugInfo] Make most debug line prologue errors non-fatal to parsing

Many of the debug line prologue errors are not inherently fatal. In most
cases, we can make reasonable assumptions and carry on. This patch does
exactly that. In the case of length problems, the approach of "assume
stated length is correct" is taken which means the offset might need
adjusting.

This is a relanding of b94191fe, fixing an LLD test and the LLDB build.

Reviewed by: dblaikie, labath

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

Added: 


Modified: 
lld/test/ELF/Inputs/undef-bad-debug.s
lld/test/ELF/undef.s
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/test/tools/llvm-dwarfdump/X86/Inputs/debug_line_malformed.s
llvm/test/tools/llvm-dwarfdump/X86/debug_line_invalid.test
llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp

Removed: 




diff  --git a/lld/test/ELF/Inputs/undef-bad-debug.s 
b/lld/test/ELF/Inputs/undef-bad-debug.s
index d52710b2efd8..bf517f3ea1cd 100644
--- a/lld/test/ELF/Inputs/undef-bad-debug.s
+++ b/lld/test/ELF/Inputs/undef-bad-debug.s
@@ -5,6 +5,8 @@ sym2:
 .quad zed6b
 sym3:
 .quad zed7
+sym4:
+.quad zed8
 
 .section .debug_line,"",@progbits
 .Lunit:
@@ -47,6 +49,12 @@ sym3:
 .Lunit2:
 .long .Lunit2_end - .Lunit2_start # unit length
 .Lunit2_start:
+.short 1# version
+.Lunit2_end:
+
+.Lunit3:
+.long .Lunit3_end - .Lunit3_start # unit length
+.Lunit3_start:
 .short 4# version
 .long .Lprologue2_end - .Lprologue2_start # prologue length
 .Lprologue2_start:
@@ -64,7 +72,7 @@ sym3:
 .byte 0
 .Lprologue2_end:
 .byte 0, 9, 2   # DW_LNE_set_address
-.quad sym3
+.quad sym4
 .byte 3 # DW_LNS_advance_line
 .byte 10
 .byte 1 # DW_LNS_copy
@@ -79,7 +87,7 @@ sym3:
 .byte 99# DW_LNS_advance_pc
 .byte 119
 # Missing end of sequence.
-.Lunit2_end:
+.Lunit3_end:
 
 .section .debug_info,"",@progbits
 .long   .Lcu_end - .Lcu_start   # Length of Unit
@@ -117,6 +125,21 @@ sym3:
 .byte   0   # End Of Children Mark
 .Lcu2_end:
 
+.long   .Lcu3_end - .Lcu3_start # Length of Unit
+.Lcu3_start:
+.short  4   # DWARF version number
+.long   .Lsection_abbrev# Offset Into Abbrev. Section
+.byte   8   # Address Size (in bytes)
+.byte   1   # Abbrev [1] 0xb:0x79 DW_TAG_compile_unit
+.long   .Lunit3 # DW_AT_stmt_list
+.byte   2   # Abbrev [2] 0x2a:0x15 DW_TAG_variable
+.long   .Linfo3_string  # DW_AT_name
+# DW_AT_external
+.byte   1   # DW_AT_decl_file
+.byte   3   # DW_AT_decl_line
+.byte   0   # End Of Children Mark
+.Lcu3_end:
+
 .section .debug_abbrev,"",@progbits
 .Lsection_abbrev:
 .byte   1   # Abbreviation Code
@@ -148,3 +171,5 @@ sym3:
 .asciz "sym2"
 .Linfo2_string:
 .asciz "sym3"
+.Linfo3_string:
+.asciz "sym4"

diff  --git a/lld/test/ELF/undef.s b/lld/test/ELF/undef.s
index 2ca733a26fd7..b8df0458539d 100644
--- a/lld/test/ELF/undef.s
+++ b/lld/test/ELF/undef.s
@@ -22,7 +22,7 @@
 # CHECK-NEXT: >>> referenced by undef.s
 # CHECK-NEXT: >>>   {{.*}}:(.text+0x10)
 
-# CHECK:  error: undefined symbol: vtable for Foo
+# CHECK:  error: undefined symbol: vtable for Foo 
 # CHECK-NEXT: >>> referenced by undef.s
 # CHECK-NEXT: >>>   {{.*}}:(.text+0x15)
 # CHECK-NEXT: the vtable symbol may be undefined because the class is missing 
its key function (see https://lld.llvm.org/missingkeyfunction)
@@ -52,17 +52,25 @@
 # is requested, even if that particular part of the line information is not 
currently required.
 # Also show that the warnings are only printed once.
 # CHECK:  warning: parsing line table prologue at 0x should have 
ended at 0x0038 but it ended at 0x0037
-# CHECK-NEXT: warning: last sequence in debug line table at offset 0x005b 
is not terminated
+# CHECK-NEXT: warning: parsing line table prologue at offset 0x005b found 
unsupported version 0x01
+# CHECK-NEXT: warning: last sequence in debug line table at offset 0x0061 
is not terminated
 # CHECK:  error: undefi

[Lldb-commits] [libc] [lldb] [llvm] [mlir] [polly] Fix simple bugs (PR #117151)

2024-11-21 Thread James Henderson via lldb-commits

https://github.com/jh7370 commented:

I think these need to be split into individual PRs, as each will want reviewing 
on its own merits, and potentially they might indicate missing test coverage, 
warranting a test.

https://github.com/llvm/llvm-project/pull/117151
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits