Commit Graph

33 Commits

Author SHA1 Message Date
Enrico Granata 520a422bd8 Add a --element-count option to the expression command
This option evaluates an expression and, if the result is of pointer type, treats it as if it was an array of that many elements and displays such elements

This has a couple subtle points but is mostly as straightforward as it sounds

Add a parray N <expr> alias for this new mode

Also, extend the --object-description mode to do the moral equivalent of the above but display each element in --object-description mode
Add a poarray N <expr> alias for this

llvm-svn: 267372
2016-04-25 00:52:47 +00:00
Enrico Granata c1b7c09ac4 Add a more tweakable way for ValueObjectPrinter to control pointer expansion. NFC.
llvm-svn: 243301
2015-07-27 18:34:14 +00:00
Zachary Turner 1124045ac7 Don't #include "lldb-python.h" from anywhere.
Since interaction with the python interpreter is moving towards
being more isolated, we won't be able to include this header from
normal files anymore, all includes of it should be localized to
the python library which will live under source/bindings/API/Python
after a future patch.

None of the files that were including this header actually depended
on it anyway, so it was just a dead include in every single instance.

llvm-svn: 238581
2015-05-29 17:41:47 +00:00
Vince Harron 5275aaa0cc Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ
The refactor was motivated by some comments that Greg made
http://reviews.llvm.org/D6918

and also to break a dependency cascade that caused functions linking
in string->int conversion functions to pull in most of lldb

llvm-svn: 226199
2015-01-15 20:08:35 +00:00
Enrico Granata a126e462c2 Do some cleanup of DumpValueObjectOptions. The whole concept of raw printing was split between feature-specific flags, and an m_be_raw flag, which then drove some other changes in printing behavior. Clean that up, so that each functionality has its own flag .. oh, and make the bools all go in a bitfield since I may want to add more of those over time
llvm-svn: 222548
2014-11-21 18:47:26 +00:00
Enrico Granata 0f883ffbdb Add a -V <bool> flag to frame variable/expression that enables execution of type validators. The jury is still out on what the user experience of type validators should be, so for now gate it on a specific flag. The mode I am using is prefix variables that fail to validate with a bang, and then emitting the actual validation error on a separate line. Of course, given the total absence of validators, this should never actually happen to you
llvm-svn: 217303
2014-09-06 02:20:19 +00:00
Zachary Turner d37221dc5d Revert "Fix broken tests due to new error output."
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and
re-enables OptionValidators.

llvm-svn: 212627
2014-07-09 16:31:49 +00:00
Todd Fiala 9734280f33 Fix broken tests due to new error output.
This reverses out the options validators changes.  We'll get these
back in once the changes to the output can be resolved.

Restores broken tests on FreeBSD, Linux, MacOSX.

Changes reverted: r212500, r212317, r212290.

llvm-svn: 212543
2014-07-08 15:55:32 +00:00
Zachary Turner de963e9a09 Adds the notion of an OptionValidator.
The purpose of the OptionValidator is to determine, based on some
arbitrary set of conditions, whether or not a command option is
valid for a given debugger state.  An example of this might be
to selectively disable or enable certain command options that
don't apply to a particular platform.

This patch contains no functional change, and does not actually
make use of an OptionValidator for any purpose yet.  A follow-up
patch will begin to add the logic and users of OptionValidator.

Reviewed by: Greg Clayton, Jim Ingham

Differential Revision: http://reviews.llvm.org/D4369

llvm-svn: 212290
2014-07-03 20:34:18 +00:00
Ed Maste d78c9576ca Switch NULL to C++11 nullptr in source/Interpreter
Patch by Robert Matusewicz

llvm-svn: 206711
2014-04-20 00:31:37 +00:00
Enrico Granata 4d93b8cdf3 <rdar://problem/14393032>
DumpValueObject() 2.0

This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command:
- expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull)
 When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in
(lldb) expr -O -v -- foo
(id) $0 = 0x000000010010baf0 {
    1 = 2;
    2 = 3;
}

 When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in
(lldb) expr -O -- foo
{
    1 = 2;
    2 = 3;
}

- for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display
(lldb) po 5
5
-v also works in this mode
(lldb) expr -O -vfull -- 5
(int) $4 = 5 

On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future
DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed

Test case to follow

llvm-svn: 191694
2013-09-30 19:11:51 +00:00
Virgile Bello e2607b50ea Add OptionParser.h
llvm-svn: 190063
2013-09-05 16:42:23 +00:00
Enrico Granata 9fb5ab558b Our commands that end up displaying a ValueObject as part of their workflow use OptionGroupValueObjectDisplay as their currency for deciding the final representation
ValueObjects themselves use DumpValueObjectOptions as the currency for the same purpose

The code to convert between these two units was replicated (to varying degrees of correctness) in several spots in the code
This checkin provides one and only one (and hopefully correct :-) entry point for this conversion

llvm-svn: 178044
2013-03-26 18:04:53 +00:00
Enrico Granata 7b8c513f08 Option changes:
the option to print the runtime-specific description has been modified in the frame variable, memory read and expression command.

All three commands now support a --object-description option, with a shortcut of -O (uppercase letter o)

This is a breaking change:
frame variable used --objc as the long option name
expression used -o as a shortcut
memory read uses --objd as the long option name

Hopefully, most users won't be affected by the change since people tend to access "expression --object-description" under the alias "po" which still works

The test suite has been tweaked accordingly.

llvm-svn: 169961
2012-12-12 03:23:37 +00:00
Daniel Malea 93a64300f8 Fix Linux build warnings due to redefinition of macros:
- add new header lldb-python.h to be included before other system headers
- short term fix (eventually python dependencies must be cleaned up)

Patch by Matt Kopec!

llvm-svn: 169341
2012-12-05 00:20:57 +00:00
Greg Clayton 3bcdfc0ec1 <rdar://problem/12798131>
Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite.

This fix does the following:
- make sure all short options are treated as "int"
- make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired
- fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates
- fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value

llvm-svn: 169189
2012-12-04 00:32:51 +00:00
Filipe Cabecinhas b4cb0be3b7 Some more typing-related fixes.
llvm-svn: 163638
2012-09-11 18:11:07 +00:00
Greg Clayton 67cc06366c Reimplemented the code that backed the "settings" in lldb. There were many issues with the previous implementation:
- no setting auto completion
- very manual and error prone way of getting/setting variables
- tons of code duplication
- useless instance names for processes, threads

Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing".

llvm-svn: 162366
2012-08-22 17:17:09 +00:00
Enrico Granata e58a507da1 <rdar://problem/11576169> Better documentation string for the -Y option to frame variable
llvm-svn: 161464
2012-08-08 01:12:11 +00:00
Johnny Chen 6ebc8c4598 Include llvm/ADT/STLExtras.h from lldb/Utility/Utils.h and use llvm::array_lengthof(), instead.
llvm-svn: 156876
2012-05-15 23:21:36 +00:00
Greg Clayton 82f4cf46aa A simple fix for the GDB format strings so the byte size parameter gets
properly marked as valid.

Also modified the "memory read" command to be able to intelligently repeat
subsequent memory requests, so now you can do:

(lldb) memory read --format hex --count 32 0x1000

Then hit enter to keep viewing the memory that follows the last valid request.

llvm-svn: 143015
2011-10-26 04:32:38 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Greg Clayton cf0e4f0daf Re-organized the contents of RangeMap.h to be more concise and also allow for a Range, RangeArray, RangeData (range + data), or a RangeDataArray. We have many range implementations in LLDB and I will be converting over to using the classes in RangeMap.h so we can have one set of code that does ranges and searching of ranges.
Fixed up DWARFDebugAranges to use the new range classes.

Fixed the enumeration parsing to take a lldb_private::Error to avoid a lot of duplicated code. Now when an invalid enumeration is supplied, an error will be returned and that error will contain a list of the valid enumeration values.

llvm-svn: 141382
2011-10-07 18:58:12 +00:00
Greg Clayton c14ee32db5 Converted the lldb_private::Process over to use the intrusive
shared pointers.

Changed the ExecutionContext over to use shared pointers for
the target, process, thread and frame since these objects can
easily go away at any time and any object that was holding onto
an ExecutionContext was running the risk of using a bad object.

Now that the shared pointers for target, process, thread and
frame are just a single pointer (they all use the instrusive
shared pointers) the execution context is much safer and still
the same size. 

Made the shared pointers in the the ExecutionContext class protected
and made accessors for all of the various ways to get at the pointers,
references, and shared pointers.

llvm-svn: 140298
2011-09-22 04:58:26 +00:00
Johnny Chen 7c575b3b3a Refactoring: replace a bunch of static array size computation or hardcoded constant
with a template function 'arraysize(static_array)', defined in Utils.h.

llvm-svn: 139444
2011-09-10 00:48:33 +00:00
Enrico Granata 22c55d180d *Some more optimizations in usage of ConstString
*New setting target.max-children-count gives an upper-bound to the number of child objects that will be displayed at each depth-level
  This might be a breaking change in some scenarios. To override the new limit you can use the --show-all-children (-A) option
  to frame variable or increase the limit in your lldbinit file
*Command "type synthetic" has been split in two:
  - "type synthetic" now only handles Python synthetic children providers
  - the new command "type filter" handles filters
  Because filters and synthetic providers are both ways to replace the children of a ValueObject, only one can be effective at any given time.

llvm-svn: 137416
2011-08-12 02:00:06 +00:00
Enrico Granata ce68b02c99 CFString.py now shows contents in a more NSString-like way (e.g. you get @"Hello" instead of "Hello")
new --raw-output (-R) option to frame variable prevents using summaries and synthetic children
 other future formatting enhancements will be excluded by using the -R option
 test case enhanced to check that -R works correctly

llvm-svn: 137185
2011-08-09 23:50:01 +00:00
Enrico Granata d55546b27a when typing a summary string you can use the %S symbol to explicitly indicate that you want the summary to be used to print the target object
(e.g. ${var%S}). this might already be the default if your variable is of an aggregate type
new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset
 - the restricted list of children obeys the typical rules (e.g. summaries prevail over children)
 - one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible
 - to provide a synthetic children list use the "type synth add" command, as in:
   type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4]
   (you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported)
 - a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones

llvm-svn: 135731
2011-07-22 00:16:08 +00:00
Enrico Granata 0c5ef693a2 Some descriptive text for the Python script feature:
- help type summary add now gives some hints on how to use it
frame variable and target variable now have a --no-summary-depth (-Y) option:
 - simply using -Y without an argument will skip one level of summaries, i.e.
   your aggregate types will expand their children and display no summary, even
   if they have one. children will behave normally
 - using -Y<int>, as in -Y4, -Y7, ..., will skip as many levels of summaries as
   given by the <int> parameter (obviously, -Y and -Y1 are the same thing). children
   beneath the given depth level will behave normally
 -Y0 is the same as omitting the --no-summary-depth parameter entirely
 This option replaces the defined-but-unimplemented --no-summary

llvm-svn: 135336
2011-07-16 01:22:04 +00:00
Johnny Chen 4bee32e53a Headers have been moved to /includes/lldb/Interpreter. This patch
reflects this change.

Marco Minutoli <mminutoli@gmail.com>

llvm-svn: 131306
2011-05-13 20:21:08 +00:00
Jim Ingham 2837b766f5 Change "frame var" over to using OptionGroups (and thus the OptionGroupVariableObjectDisplay).
Change the boolean "use_dynamic" over to a tri-state, no-dynamic, dynamic-w/o running target,
and dynamic with running target.

llvm-svn: 130832
2011-05-04 03:43:18 +00:00
Greg Clayton 68ebae61d1 Added the ability to specify dumping options (show types, show location,
depth control, pointer depth, and more) when dumping memory and viewing as
a type.

llvm-svn: 130436
2011-04-28 20:55:26 +00:00
Greg Clayton 84c39663a9 Added a new OptionValue subclass for lldb::Format: OptionValueFormat. Added
new OptionGroup subclasses for:
- output file for use with options: 
        long opts: --outfile <path> --append--output
        short opts: -o <path> -A
        
- format for use with options:
        long opts: --format <format>

- variable object display controls for depth, pointer depth, wether to show
  types, show summary, show location, flat output, use objc "po" style summary.
  
Modified ValueObjectMemory to be able to be created either with a TypeSP or
a ClangASTType.

Switched "memory read" over to use OptionGroup subclasses: one for the outfile
options, one for the command specific options, and one for the format.

llvm-svn: 130334
2011-04-27 22:04:39 +00:00