Commit Graph

420 Commits

Author SHA1 Message Date
Pavel Labath cb6c9f731b [lldb] Make gdbremote.py utility py2and3 compatible 2020-02-13 09:18:55 +01:00
Jonas Devlieghere b6ae524cd2 [Examples] Move structured-data unpacking out of the loop. (NFC)
There's no need to repeat this work in the loop.
2019-11-22 15:43:39 -08:00
Jonas Devlieghere 1b099c1df0 [Examples] Add in_call_stack breakpoint function.
The in_call_stack Python script makes it possible to modify the last
breakpoint to only stop if a given function is present in the call
stack. It will check both the symbol name and the function name (coming
from the debug info, in case the binary is stripped).

To use this, you have to:

1. Import the script into lldb.

(lldb) command script import in_call_stack.py

2. Set a breakpoint and use the in_call_stack alias.

(lldb) b foo
(lldb) in_call_stack bar

Note that this alias operates on the last set breakpoint. You can re-run
the in_call_stack command to modify the condition.
2019-11-22 15:36:42 -08:00
Adrian Prantl ff9d732887 crashlog.py: Improve regular expressions
This is yet another change to the regular expressions in crashlog.py
that fix a few edge cases, and attempt to improve the readability
quite a bit in the process. My last change to support spaces in
filenames introduced a bug that caused the version/archspec field to
be parsed as part of the image name.

For example, in "0x1111111 - 0x22222 +MyApp Pro arm64 <01234>", the
name of the image was recognized as "MyApp Pro arm64" instead of
"MyApp Pro" with a "version" of arm64.

The bugfix makes the space following an optional field mandatory
*inside* the optional group.

rdar://problem/56883435

Differential Revision: https://reviews.llvm.org/D69871
2019-11-07 10:52:06 -08:00
Vedant Kumar 64adf7b6ae Revert [heap.py] Add missing declaration for malloc_get_all_zones
This reverts r369684 (git commit cc62e38d25)

Adding a declaration doesn't appear to be a sufficient fix.

llvm-svn: 369706
2019-08-22 21:01:45 +00:00
Vedant Kumar cc62e38d25 [heap.py] Add missing declaration for malloc_get_all_zones
The evaluation context isn't guaranteed to have this declaration.

Fixes "error: use of undeclared identifier 'malloc_get_all_zones'" bugs.

llvm-svn: 369684
2019-08-22 18:51:03 +00:00
Davide Italiano 9a5fbc8163 [Symbolication] Remove some dead code. Nothing exciting.
llvm-svn: 367262
2019-07-29 21:25:51 +00:00
Davide Italiano f80c72be20 [Symbolication] Remove a duplicate assignment.
llvm-svn: 367261
2019-07-29 21:25:45 +00:00
Davide Italiano acc626bc57 [Symbolication] Fix unicode compatibility between 2 and 3.
Triples are always ASCII for now, but we were handed out a
unicode object.

<rdar://problem/53592772>

llvm-svn: 367260
2019-07-29 21:25:37 +00:00
Davide Italiano 68946d10ad [crashlog] Fix a mismatch between bytes and strings.
The functions in read_plist() want bytes as input, not
strings.

<rdar://problem/52600712>

llvm-svn: 365416
2019-07-09 01:05:12 +00:00
Jason Molenda ddf025e8dc Use the // integer divide operator in these
target definition files, like Davide's change to x86_64_target_definition.py.

llvm-svn: 364481
2019-06-26 21:41:07 +00:00
Davide Italiano 4201ed2ea3 [x86-64] Use `//` for integer division in the target definition.
This forces integer division and works with python 2 and python 3.

<rdar://problem/52073911>

llvm-svn: 364465
2019-06-26 19:51:57 +00:00
Adrian Prantl 573ffd88a0 Python 3: decode string as utf-8 to avoid type mismatch.
rdar://problem/51464644

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

llvm-svn: 363413
2019-06-14 15:39:14 +00:00
Adrian Prantl 38be2c65b6 Make crashlog.py less noisy
For end-users there is no point in printing dSYM load errors for
system frameworks, since they will all fail and there's nothing they
can do about it. This patch hides them by default and shows them when
--verbose is present.

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

llvm-svn: 363412
2019-06-14 15:39:11 +00:00
Stefan Granitz 61a7ab7fdb [lldb] Ignore null frames in lldb.macosx crashlog
llvm-svn: 363172
2019-06-12 14:46:37 +00:00
Davide Italiano 192dd7df2f [crashlog] Add a missing call to decode.
<rdar://problem/51139357>

llvm-svn: 362044
2019-05-30 00:35:43 +00:00
Davide Italiano 8803124d23 [crashlog] Use loads() instead of readPlistFromString() for python 3.
<rdar://problem/50903413>

llvm-svn: 361087
2019-05-18 01:57:12 +00:00
Davide Italiano 185de8eeaa [Python] Simplify the code. NFCI.
llvm-svn: 358721
2019-04-18 23:24:54 +00:00
Davide Italiano 085626a873 [crashlog] Strip trailing `\n` from check_output return.
Generally having spurious `\n` doesn't matter, but here the
returning string is a command which is executed, so  we want
to strip it. Pointed out by Jason.

llvm-svn: 358717
2019-04-18 21:32:36 +00:00
Davide Italiano e3b5eba1ba [crashlog] Use the right path for dsymforUUID and remove an unnecessary import.
<rdar://problem/49925960>

llvm-svn: 358615
2019-04-17 21:51:55 +00:00
Jonas Devlieghere 8b3af63b89 [NFC] Remove ASCII lines from comments
A lot of comments in LLDB are surrounded by an ASCII line to delimit the
begging and end of the comment.

Its use is not really consistent across the code base, sometimes the
lines are longer, sometimes they are shorter and sometimes they are
omitted. Furthermore, it looks kind of weird with the 80 column limit,
where the comment actually extends past the line, but not by much.
Furthermore, when /// is used for Doxygen comments, it looks
particularly odd. And when // is used, it incorrectly gives the
impression that it's actually a Doxygen comment.

I assume these lines were added to improve distinguishing between
comments and code. However, given that todays editors and IDEs do a
great job at highlighting comments, I think it's worth to drop this for
the sake of consistency. The alternative is fixing all the
inconsistencies, which would create a lot more churn.

Differential revision: https://reviews.llvm.org/D60508

llvm-svn: 358135
2019-04-10 20:48:55 +00:00
Serge Guelton 1a12dd70c0 python 2/3 compat: commands vs subprocess
Differential Revision: https://reviews.llvm.org/D59584

llvm-svn: 356995
2019-03-26 14:46:15 +00:00
Serge Guelton 3a22c3cc2b Python 2/3 compat: StringIO
Differential Revision: https://reviews.llvm.org/D59582

llvm-svn: 356910
2019-03-25 15:23:34 +00:00
Serge Guelton 6ee3804613 Python 2/3 compat: tkinter
Differential Revision: https://reviews.llvm.org/D59586

llvm-svn: 356909
2019-03-25 15:22:41 +00:00
Serge Guelton 0bc1447845 Python 2/3 compat: str vs basestring
Differential Revision: https://reviews.llvm.org/D59589

llvm-svn: 356908
2019-03-25 15:21:29 +00:00
Serge Guelton cdfcbbd348 Python 2/3 compat: unichr vs chr
llvm-svn: 356904
2019-03-25 15:12:48 +00:00
Serge Guelton 525cd59f5a Python 2/3 compatibility: from __future__ import print_function
Differential Revision: https://reviews.llvm.org/D59580

llvm-svn: 356695
2019-03-21 18:27:40 +00:00
Serge Guelton ce54fa1855 Workaround items/iteritems difference between Python2 and Python3
Differential Revision: https://reviews.llvm.org/D59588

llvm-svn: 356673
2019-03-21 14:47:40 +00:00
Serge Guelton bfb779188f Portable int/long conversion across Python 2 / Python 3
Differential Revision: https://reviews.llvm.org/D59585

llvm-svn: 356671
2019-03-21 14:41:34 +00:00
Serge Guelton 3577da7667 Portable exception value access across Python 2 / Python 3
Differential Revision: https://reviews.llvm.org/D59583

llvm-svn: 356670
2019-03-21 14:39:55 +00:00
Jason Molenda 2d5e7adf26 A target definition file that may work for
Aarch32 Cortex-M target processor debugging.

<rdar://problem/48448564> 

llvm-svn: 356416
2019-03-18 21:39:54 +00:00
Pavel Labath 22457e66c5 Fix libstdc++ data formatters for python3
Use floor-division for consistentcy across python versions. This fixes a
couple of libstdc++ data formatter tests.

llvm-svn: 356377
2019-03-18 15:42:08 +00:00
Davide Italiano ca715b6ea0 [Python] Fix another batch of python 2/python 3 portability issues.
llvm-svn: 355998
2019-03-13 00:48:29 +00:00
Adrian Prantl f05b42e960 Bring Doxygen comment syntax in sync with LLVM coding style.
This changes '@' prefix to '\'.

llvm-svn: 355841
2019-03-11 17:09:29 +00:00
Adrian Prantl f4d2fa3fa0 crashlog.py: Catch exception from subprocess.
llvm-svn: 355572
2019-03-07 00:41:51 +00:00
Davide Italiano 9a8e777f8c [Python] Unbreak the recently modified tests for python 2.
llvm-svn: 355566
2019-03-06 23:50:36 +00:00
Davide Italiano a658ab9f55 [testsuite] Port crashlog to python 3, second attempt.
llvm-svn: 355562
2019-03-06 22:54:11 +00:00
Davide Italiano 814ad73452 Revert "[testsuite] Port crashlog and dependencies to Python 3."
This revert the commit because it broke the bots. I need to find
a way that works with both versions.

llvm-svn: 355364
2019-03-05 01:34:47 +00:00
Davide Italiano fc188448fa [testsuite] Port crashlog and dependencies to Python 3.
Fixes three tests in the testsuite.

llvm-svn: 355359
2019-03-05 00:53:38 +00:00
Shafik Yaghmour d03bf06883 Fix use of non-existing variable in crashlog.py
Summary:
The method find_matching_slice(self) uses uuid_str on one of the paths but the variable does not exist and so this results in a NameError exception if we take that path.

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

llvm-svn: 352772
2019-01-31 17:33:17 +00:00
Nathan Lanza f9c2f2c0b7 Fix order of arguments in an lldb type summary in examples
The format for the -w argument is:

    -w name ( --category name )

Rearrange the flags correctly.

llvm-svn: 351664
2019-01-19 20:08:41 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Davide Italiano e1f760d5de Fix lldb's macosx/heap.py cstr command.
<rdar://problem/44432167>

llvm-svn: 349372
2018-12-17 18:21:51 +00:00
Adrian Prantl f700c8b253 Make crashlog.py work or binaries with spaces in their names
This is a little dangerous since the crashlog files aren't 100%
unambiguous, but the risk is mitigated by using a non-greedy +?
pattern.

rdar://problem/38478511

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

llvm-svn: 349367
2018-12-17 17:26:04 +00:00
Adrian Prantl fb5aa932b1 Make crashlog.py work when a .dSYM is present, but a binary is missing
Often users have a crash log an d a .dSYM bundle, but not the original
application binary. It turns out that for crash symbolication, we can
safely fall back to using the binary inside the .dSYM bundle.

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

llvm-svn: 349366
2018-12-17 17:25:57 +00:00
Jonas Devlieghere ceff6644bb Remove header grouping comments.
This patch removes the comments grouping header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

llvm-svn: 346626
2018-11-11 23:17:06 +00:00
Jonas Devlieghere 672d2c1255 Remove comments after header includes.
This patch removes the comments following the header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

Differential revision: https://reviews.llvm.org/D54385

llvm-svn: 346625
2018-11-11 23:16:43 +00:00
Greg Clayton 141f208e12 Fixes for GDB remote packet disassembler:
- Add latency timings to GDB packet log summary if timestamps are on log
- Add the ability to plot the latencies for each packet type with --plot
- Don't crash the script when target xml register info is in wierd format

llvm-svn: 343243
2018-09-27 17:55:36 +00:00
Greg Clayton 95c23f6643 Add an interactive mode to BSD archive parser.
llvm-svn: 343242
2018-09-27 17:45:14 +00:00
Greg Clayton ef115de629 Update cmdtemplate.py to use best pratices.
Fixes include:
- fix all lint errors
- add code that will automatically register and LLDB command classes by detecting the classes and any classes that have a "register_lldb_command" function
  - automatically fill in the correct module name when registering commands
  - automatically fill in the class name when registering command

llvm-svn: 335401
2018-06-22 23:34:24 +00:00