Commit Graph

26176 Commits

Author SHA1 Message Date
Alisamar Husain ca47011e73 [tests][intelpt] Fix outdated trace load test
Differential Revision: https://reviews.llvm.org/D122114
2022-03-21 13:21:45 +05:30
Pavel Labath 8bf8934666 Revert "[lldb/test] Add events listener helper class to lldbtest"
It removes the "wait-until-event-thread-stops" logic, which makes
TestDiagnosticReporting.py flaky.

This reverts commits 09ff41a087 and
acdd41b459.
2022-03-21 08:32:16 +01:00
Alisamar Husain 37a466dd72 [trace][intelpt] Added total memory usage by decoded trace
This fails currently but the basics are there

Differential Revision: https://reviews.llvm.org/D122093
2022-03-21 12:36:08 +05:30
Alisamar Husain 8271220a99 [trace][intelpt] Instruction count in trace info
Added a line to `thread trace dump info` results which shows total number of instructions executed until now.

Differential Revision: https://reviews.llvm.org/D122076
2022-03-20 11:28:16 +05:30
Alisamar Husain 1bcc28b884 [docs] Fixed minor ordering issue
Differential Revision: https://reviews.llvm.org/D122073
2022-03-19 22:23:42 +05:30
Alisamar Husain 752e9cdbb0 [trace][intelpt][docs] Added intel-pt build instructions for lldb
Differential Revision: https://reviews.llvm.org/D121935
2022-03-19 15:26:59 +05:30
Med Ismail Bennani acdd41b459 [lldb/test] Fix typo in eventlistener.py (NFC)
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-03-18 21:59:11 -07:00
Med Ismail Bennani 09ff41a087 [lldb/test] Add events listener helper class to lldbtest
This patch introduces a generic helper class that will listen for
event in a background thread and match it against a source broadcaster.

If the event received matches the source broadcaster, the event is
queued up in a list that the user can access later on.

The motivation behind this is to easily test new kinds of events
(i.e. Swift type-system progress events). However, this patch also
updates `TestProgressReporting.py` and `TestDiagnosticReporting.py`
to make use of this new helper class.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-03-18 16:35:33 -07:00
Walter Erquinigo b7d525ad38 [trace][intelpt] fix some test failures
Minor fixes needed and now `./bin/lldb-dotest -p TestTrace` passes
correctly.

- There was an incorrect iteration.
- Some error messages changed.
- The way repeat commands are handled changed a bit, so I had to create
a new --continue arg in "thread trace dump instructions" to handle this
correctly.

Differential Revision: https://reviews.llvm.org/D122023
2022-03-18 10:35:34 -07:00
Jonas Devlieghere 453f8c87ff
[lldb] Remove lldb/lldb subdir created by wrong patch level
Bad application of patch -p<level>.
2022-03-18 09:06:15 -07:00
David Spickett 9f052f3dd2 [lldb] Require x86 target for NativePDB test
This test would fail if you only build for example,
just the AArch64 backend, due to the x86 triple.
2022-03-18 12:31:03 +00:00
Pavel Labath af4da4f995 [lldb] Increase timeout in TestProcessIOHandlerInterrupt
The small value was not meant to be checked in.
2022-03-18 12:14:10 +01:00
Pavel Labath a4d6de2031 [lldb] Fix TestProcessIOHandlerInterrupt.py for macos
On darwin, we don't completely suppress the signal used to interrupt the
inferior. The underlying read syscall returns EINTR, which causes premature
termination of the input loop.

Work around that by hand-rolling an EINTR-resistant version of getline.
2022-03-18 11:51:55 +01:00
Pavel Labath 14bd14f9f9 [lldb] Fix ^C handling in IOHandlerProcessSTDIO
D120762 accidentally moved the interrupt check into the block which was
reading stdio. This meant that a ^C only took effect after a regular
character has been pressed.

This patch fixes that and adds a (pexpect) test.

Differential Revision: https://reviews.llvm.org/D121912
2022-03-18 08:58:30 +01:00
Pavel Labath 53e9ee3027 Revert "[lldb] Fix ^C handling in IOHandlerProcessSTDIO"
This reverts commit f93d861349 -- looks
like a bad application of `patch -p<level>`
2022-03-18 08:58:30 +01:00
Pavel Labath c7fc7205bb [lldb] Add more documentation on test variants
This formalizes some of the discussion on D121631.

Differential Revision: https://reviews.llvm.org/D121900
2022-03-18 08:58:29 +01:00
Pavel Labath 0f362f9d25 [lldb] Remove process->LoadModules call from DynamicLoaderPOSIXDYLD
The call is useless, as any modules loaded there will be removed in
ResolveExecutableModule. Modules will be reloaded again through the
GetLoadedModuleList call in DYLDRendezvous.cpp.
2022-03-18 08:58:29 +01:00
Jonas Devlieghere 74b45f91b8
[lldb] Migrate ProcessGDBRemote to ReportWarning 2022-03-17 15:13:48 -07:00
Pavel Labath f93d861349
[lldb] Fix ^C handling in IOHandlerProcessSTDIO
D120762 accidentally moved the interrupt check into the block which was
reading stdio. This meant that a ^C only took effect after a regular
character has been pressed.

This patch fixes that and adds a (pexpect) test.

Differential revision: https://reviews.llvm.org/D121912
2022-03-17 11:52:19 -07:00
Shafik Yaghmour 33d74170a3 [LLDB] Modifying expression code in MakeLoadImageUtilityFunction to be more consistent
MakeLoadImageUtilityFunction() is not using extern "C" for external C functions
and it is not using eLanguageTypeC_plus_plus. So I am modifying it to be consistent.

Also see: rdar://87544782

Differential Revision: https://reviews.llvm.org/D121831
2022-03-17 08:52:56 -07:00
Jonas Devlieghere 7ed1abd4a6
[lldb] Skip invalid-condition.test on Windows
This test is making the Windows bot unhappy. Unfortunately the output
doesn't tell me much about what exactly is wrong.
2022-03-17 08:34:12 -07:00
Jonas Devlieghere cae735f72b
[lldb] Migrate runtime instrumentation plugins to ReportWarning 2022-03-16 23:20:58 -07:00
Jonas Devlieghere ea0f8ecc43
[lldb] Remove commented-out code in CommandObjectExpression (NFC) 2022-03-16 23:02:59 -07:00
Jonas Devlieghere d10c0c7b18
[lldb] Migrate condition evaluation failure to ReportError
Migrate to using ReportError to report a failure to evaluate a
watchpoint condition. I had already done so for the parallel code for
breakpoints.

In the process, I noticed that I accidentally regressed the error
reporting for breakpoint conditions by dropping the call to
GetDescription. This patch rectifies that and adds a test.

Because the call to GetDescription expects a Stream*, I also switches
from using a raw_string_ostream to a StreamString for both breakpoints
and watchpoints.
2022-03-16 22:54:02 -07:00
Jonas Devlieghere 8212b41b7b
[lldb] Fix flakiness in command-disassemble-process.yaml (2/2)
I split up the test so we could stop redirecting stderr to stdout but I
forgot to include that part in the previous commit.
2022-03-16 22:12:39 -07:00
Jonas Devlieghere 557a0e7b96
[lldb] Fix flakyness in command-disassemble-process.yaml 2022-03-16 21:27:54 -07:00
Jonas Devlieghere 8e893dfed5
[lldb] Fix flakyness in Minidump/no-process-id.yaml 2022-03-16 21:21:11 -07:00
Jonas Devlieghere c354f13e69
[lldb] Update TargetProperties::CheckJITObjectsDir to use ReportError 2022-03-16 21:11:53 -07:00
Med Ismail Bennani 0a65112cf7 [lldb/crashlog] Create artificial frames for non-crashed scripted threads
This patch pipes down the `-a|--load-all` crashlog command option to the
Scripted Process initializer to load all the images used by crashed
process instead of only loading the images related to the crashed
thread.

This allows us to recreate artificial frames also for the non-crashed
scripted threads.

rdar://90396265

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-03-16 15:50:10 -07:00
Jakob Johnson 22077627ae Minor refactor and renaming:
- Rename IntelPTManager class and files to IntelPTCollector
  - Change GetTimestampCounter API to general trace counter API,
    GetCounter

Differential Revision: https://reviews.llvm.org/D121711
2022-03-16 15:35:36 -07:00
Jonas Devlieghere ff9e596b10
[lldb] Expose diagnostic events through the SB API
Expose diagnostic events through the SB API. Unlike the progress events,
I opted to use a SBStructuredData so that we can add fields in the
future.

Differential revision: https://reviews.llvm.org/D121818
2022-03-16 15:03:31 -07:00
Yonghong Song 212f714ff7 [lldb] add missed handling for new BTFTagAttributed type
Commit 3251ba2d0f ("[Attr] Fix a btf_type_tag AST generation")
added a new type BTFTagAttributedType to the clang AST type
system. There are a few places in lldb needed to handle this type
similar to Attributed type to avoid compilation warning/error
when 'switch' is used to enumerate all types.
2022-03-16 11:00:35 -07:00
Jonas Devlieghere 3f0e050842
[lldb] Fix Minidump/no-process-id.yaml
Update warning after 2fc38b2b7b.
2022-03-16 09:32:06 -07:00
Jonas Devlieghere 2fc38b2b7b
[lldb] Report debugger diagnostics as events
Report warnings and errors through events instead of printing directly
the to the debugger's error stream. By using events, IDEs such as Xcode
can report these issues in the UI instead of having them show up in the
debugger console.

The new diagnostic events are handled by the default event loop. If a
diagnostic is reported while nobody is listening for the new event
types, it is printed directly to the debugger's error stream.

Differential revision: https://reviews.llvm.org/D121511
2022-03-16 08:33:01 -07:00
Pavel Labath ccba163d85 [lldb] Change back LLDBLog::Commands->Types in a couple more places
This was inadvertedly changed (bad search&replace) when I was removing
the LLDBLOG macros.
2022-03-16 15:46:17 +01:00
Will Hawkins d58ef6df0d [LLDB] Change enumaration to enumeration
Change enumaration to enumeration in code handling LLDB help output.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D121800
2022-03-16 15:31:25 +01:00
Will Hawkins fe93395b92 [LLDB] Fix typos in LLDB help output.
Correct a few spelling errors and typos in the LLDB help output.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D121802
2022-03-16 15:31:25 +01:00
Sam McCall 75acad41bc Use lit_config.substitute instead of foo % lit_config.params everywhere
This mechanically applies the same changes from D121427 everywhere.

Differential Revision: https://reviews.llvm.org/D121746
2022-03-16 09:57:41 +01:00
Shafik Yaghmour 37400dd3e8 [LLDB][NFC] Remove dead code from Section.cpp
Removing comment out code, looks like debugging code left over from a while ago.
2022-03-15 18:11:30 -07:00
Zequan Wu 384e890dd3 [LLDB][NativePDB] Remove REQUIRES: system-windows for local-variables-regsiters.s 2022-03-15 17:49:46 -07:00
Jonas Devlieghere 527d2c5867
[lldb] Fix AppleObjCRuntime log channels
The log channel was changed from Types to Commands in
a007a6d84471bb956abe10974cac3066799f583f:

-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+    Log *log = GetLog(LLDBLog::Process | LLDBLog::Commands);
2022-03-15 14:47:33 -07:00
Zequan Wu 583223cd5e [LLDB][NativePDB] Don't complete static members' types when completing a record type.
`UdtRecordCompleter` shouldn't complete static members' types. static members' types are going to be completed when the types are called in `SymbolFile::CompleteType`.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D121030
2022-03-15 14:06:54 -07:00
Sterling Augustine 7518e0ff63 Avoid using a variable-sized array for a tiny allocation.
Differential Revision: https://reviews.llvm.org/D121732
2022-03-15 13:00:14 -07:00
Jonas Devlieghere 8e776bb660
Re-land "[lldb] Synchronize output through the IOHandler"
Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

Differential revision: https://reviews.llvm.org/D121500
2022-03-15 12:53:46 -07:00
Jonas Devlieghere 9a5f04e01d
Revert "[lldb] Synchronize output through the IOHandler"
This reverts commit 242c574dc0 because it
breaks the following tests on the bots:

 - TestGuiExpandThreadsTree.py
 - TestBreakpointCallbackCommandSource.py
2022-03-15 09:55:30 -07:00
Shafik Yaghmour 6583f01707 [LLDB] Fixing DWARFExpression handling of ValueType::FileAddress case for DW_OP_deref_size
Currently DW_OP_deref_size just drops the ValueType::FileAddress case and does
not attempt to handle it. This adds support for this case and a test that
verifies this support.

I did a little refactoring since DW_OP_deref and DW_OP_deref_size have some
overlap in code.

Also see: rdar://66870821

Differential Revision: https://reviews.llvm.org/D121408
2022-03-15 09:36:20 -07:00
Jonas Devlieghere b783e5c203
[lldb] Make the PlatformMacOSX unit test Apple specific
I thought that x86GetSupportedArchitectures would always return
x86_64-apple-macosx as a compatible architecture, regardless of the host
achitecture, but the Debian bot disagrees with that.
2022-03-15 09:32:56 -07:00
Jonas Devlieghere 242c574dc0
[lldb] Synchronize output through the IOHandler
Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

Differential revision: https://reviews.llvm.org/D121500
2022-03-15 09:32:56 -07:00
Jonas Devlieghere c22c7a61b6
[lldb] Fix platform selection on Apple Silicon (again)
This patch is another attempt to fix platform selection on Apple
Silicon. It partially undoes D117340 which tried to fix the issue by
always instantiating a remote-ios platform for "iPhone and iPad Apps on
Apple Silicon Macs".

While the previous patch worked for attaching, it broke launching and
everything else that expects the remote platform to be connected. I made
an attempt to work around that, but quickly found out that there were
just too may places that had this assumption baked in.

This patch takes a different approach and reverts back to marking the
host platform compatible with iOS triples. This brings us back to the
original situation where platform selection was broken for remote iOS
debugging on Apple Silicon. To fix that, we now look at the process'
host architecture to differentiate between iOS binaries running remotely
and iOS binaries running locally.

I tested the following scenarios, which now all uses the desired
platform:

  - Launching an iOS binary on macOS: uses the host platform
  - Attaching to an iOS binary on macOS: uses the host platform
  - Attaching to a remote iOS binary: uses the remote-ios platform

rdar://89840215

Differential revision: https://reviews.llvm.org/D121444
2022-03-15 09:06:29 -07:00
Pavel Labath be09f83760 Revert "[lldb/test] Make category-skipping logic "platform"-independent"
This reverts commit dddf4ce034. It breaks
a couple of tests on macos.
2022-03-15 16:23:43 +01:00