summaryrefslogtreecommitdiffstats
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
...
* Added the ability for users to create new regex commands.Greg Clayton2011-04-206-6/+414
| | | | | | | | | | | | | | | | | | | | | | | | To do this currently, it must be done in multi-line mode: (lldb) commands regex --help "Help text for command" --syntax "syntax for command" <cmd-name> Any example that would use "f" for "finish" when there are no arguments, and "f <num>" to do a "frame select <num>" would be: (lldb) commands regex f Enter multiple regular expressions in the form s/find/replace/ then terminate with an empty line: s/^$/finish/ s/([0-9]+)/frame select %1/ (lldb) f 11 frame select 12 ... (lldb) f finish ... Also added the string version of the OptionValue as OptionValueString. llvm-svn: 129855
* Added the start of a new option value system that we can use for many thingsGreg Clayton2011-04-205-14/+921
| | | | | | | around the debugger. The class isn't hooked into anything yet, but it will be soon. llvm-svn: 129843
* Add the infrastructure to test instruction emulations automatically.Caroline Tice2011-04-19169-19/+21309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea is that the instruction to be emulated is actually executed on the hardware to be emulated, with the before and after state of the hardware being captured and 'freeze-dried' into .dat files. The emulation testing code then loads the before & after state from the .dat file, emulates the instruction using the before state, and compares the resulting state to the 'after' state. If they match, the emulation is accurate, otherwise there is a problem. The final format of the .dat files needs a bit more work; the plan is to generalize them a bit and to convert the plain values to key-value pairs. But I wanted to get this first pass committed. This commit adds arm instruction emulation testing to the testsuite, along with many initial .dat files. It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes were getting their upper & lower 16-bits reversed. There is a new Instruction sub-class, that is intended to be loaded from a .dat file rather than read from an executable. There is also a new EmulationStateARM class, for handling the before & after states. EmulationStates for other architetures can be added later when we emulate their instructions. llvm-svn: 129832
* Rename test/threads to python_api/lldbutil; it uses lldbutil functions to ↵Johnny Chen2011-04-193-4/+5
| | | | | | print stack traces. llvm-svn: 129828
* Use self.TraceOn() API.Johnny Chen2011-04-191-4/+6
| | | | llvm-svn: 129827
* General cleanup on the UserSettingsController stuff. There were 5 differentGreg Clayton2011-04-197-434/+427
| | | | | | | | | | | places that were dumping values for the settings. Centralized all of the value dumping into a single place. When dumping values that aren't strings we no longer surround the value with single quotes. When dumping values that are strings, surround the string value with double quotes. When dumping array values, assume they are always string values, and don't put quotes around dictionary values. llvm-svn: 129826
* Use self.TraceOn() API.Johnny Chen2011-04-191-6/+10
| | | | llvm-svn: 129825
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-17/+8
| | | | | | And use self.TraceOn() API. llvm-svn: 129797
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129795
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129793
* Use self.TraceOn() API.Johnny Chen2011-04-191-5/+9
| | | | llvm-svn: 129792
* Converted to use SBProcess.LaunchSimple() API.Johnny Chen2011-04-192-10/+14
| | | | | | And use self.TraceOn() in order to print more debug output. llvm-svn: 129791
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-5/+6
| | | | | | And use self.TraceOn() API. llvm-svn: 129790
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129789
* Only print more debug out when self.TraceOn() returns True.Johnny Chen2011-04-191-1/+2
| | | | llvm-svn: 129788
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129787
* Modify docstring.Johnny Chen2011-04-191-1/+1
| | | | llvm-svn: 129786
* Add a TraceOn(self) method to the base test class, which returns True if we areJohnny Chen2011-04-192-1/+6
| | | | | | | | currently in trace mode (-t to dotest.py), i.e., tracing the lldb command execution. Change TestInferiorCrashing.inferior_crashing_python(self) to check this flag in order to print the stack trace of the inferior thread. llvm-svn: 129785
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129784
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129782
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-3/+1
| | | | llvm-svn: 129780
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129779
* Converted to use SBProcess.LaunchSimple().Johnny Chen2011-04-191-2/+1
| | | | llvm-svn: 129778
* Convert some tests to use the SBProcess.LaunchSimple API requiring only ↵Johnny Chen2011-04-193-6/+3
| | | | | | | | args, envs, and cwd from SBProcess.Launch which takes many more arguments that are useless for the test scenario. llvm-svn: 129776
* Added a new option to the "source list" command that allows us to see whereGreg Clayton2011-04-1916-52/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | line tables specify breakpoints can be set in the source. When dumping the source, the number of breakpoints that can be set on a source line are shown as a prefix: (lldb) source list -f test.c -l1 -c222 -b 1 #include <stdio.h> 2 #include <sys/fcntl.h> 3 #include <unistd.h> 4 int 5 sleep_loop (const int num_secs) [2] 6 { 7 int i; [1] 8 for (i=0; i<num_secs; ++i) 9 { [1] 10 printf("%d of %i - sleep(1);\n", i, num_secs); [1] 11 sleep(1); 12 } 13 return 0; [1] 14 } 15 16 int 17 main (int argc, char const* argv[]) [1] 18 { [1] 19 printf("Process: %i\n\n", getpid()); [1] 20 puts("Press any key to continue..."); getchar(); [1] 21 sleep_loop (20); 22 return 12; [1] 23 } Above we can see there are two breakpoints for line 6 and one breakpoint for lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table entries for them. This helps visualize the data provided in the debug information without having to manually dump all line tables. It also includes all inline breakpoint that may result for a given file which can also be very handy to see. llvm-svn: 129747
* Fixed an issue where if you specify an architecture from the command line like:Greg Clayton2011-04-181-43/+47
| | | | | | | | | | $ lldb --arch i386-unknown-unknown a.out It would then create a target with only the "i386" part due to SBDebugger::GetDefaultArchitecture(...) truncating the arch triple due to the way things used to be. llvm-svn: 129731
* Rename some variables, no functionality change.Johnny Chen2011-04-181-8/+7
| | | | llvm-svn: 129724
* Add a test script for exercising the "taregt create", "target list", and ↵Johnny Chen2011-04-188-2/+181
| | | | | | "target select" commands. llvm-svn: 129717
* Add header comment.Johnny Chen2011-04-181-0/+8
| | | | llvm-svn: 129710
* Add docstring.Johnny Chen2011-04-181-1/+1
| | | | llvm-svn: 129707
* Modify some docstrings.Johnny Chen2011-04-181-2/+2
| | | | llvm-svn: 129706
* Centralized a lot of the status information for processes,Greg Clayton2011-04-1856-924/+1156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | threads, and stack frame down in the lldb_private::Process, lldb_private::Thread, lldb_private::StackFrameList and the lldb_private::StackFrame classes. We had some command line commands that had duplicate versions of the process status output ("thread list" and "process status" for example). Removed the "file" command and placed it where it should have been: "target create". Made an alias for "file" to "target create" so we stay compatible with GDB commands. We can now have multple usable targets in lldb at the same time. This is nice for comparing two runs of a program or debugging more than one binary at the same time. The new command is "target select <target-idx>" and also to see a list of the current targets you can use the new "target list" command. The flow in a debug session can be: (lldb) target create /path/to/exe/a.out (lldb) breakpoint set --name main (lldb) run ... hit breakpoint (lldb) target create /bin/ls (lldb) run /tmp Process 36001 exited with status = 0 (0x00000000) (lldb) target list Current targets: target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped ) * target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited ) (lldb) target select 0 Current targets: * target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped ) target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited ) (lldb) bt * thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1 frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16 frame #1: 0x0000000100000b64 a.out`start + 52 Above we created a target for "a.out" and ran and hit a breakpoint at "main". Then we created a new target for /bin/ls and ran it. Then we listed the targest and selected our original "a.out" program, so we showed two concurent debug sessions going on at the same time. llvm-svn: 129695
* Add support for "dynamic values" for C++ classes. This currently only works ↵Jim Ingham2011-04-1638-239/+1740
| | | | | | | | | | | | | | | | | | for "frame var" and for the expressions that are simple enough to get passed to the "frame var" underpinnings. The parser code will have to be changed to also query for the dynamic types & offsets as it is looking up variables. The behavior of "frame var" is controlled in two ways. You can pass "-d {true/false} to the frame var command to get the dynamic or static value of the variables you are printing. There's also a general setting: target.prefer-dynamic-value (boolean) = 'true' which is consulted if you call "frame var" without supplying a value for the -d option. llvm-svn: 129623
* Fix comment typo.Jim Ingham2011-04-151-1/+1
| | | | llvm-svn: 129621
* Work around a llvm gcc bug where the name of a reference doesn't include the ↵Jim Ingham2011-04-151-1/+10
| | | | | | "&". llvm-svn: 129620
* Get rid the of set membership test (log(m)) and, instead, use an index ↵Johnny Chen2011-04-151-3/+4
| | | | | | | | | variable 'i' which advances when src collides with a purged slot. Hi Stephen, you're welcome to overwrite/or improve upon this version. Thanks. llvm-svn: 129611
* Update both the src and dst pointers at the end of the loop.Johnny Chen2011-04-151-1/+1
| | | | | | Stephen Wilson is working on a better performing patch in the meantime. llvm-svn: 129605
* Optimize address range coalescing.Johnny Chen2011-04-151-22/+35
| | | | | | | | | | | | | | | | | | | | | | | DWARFDebugAranges::Sort() calls std::stable_sort() over a set of address ranges and then proceeds to collapse neighboring ranges together. One problem with the current implementation is that it does an incomplete job. When a pair of ranges are merged the next pair considered does not include the just-merged range. IOW, three consecutive ranges are never collapsed into one. Another problem is that for each range merged we are calling std::vector::erase() which "shifts" all remaining elements of the vector by one position on every merge. The end result (in the worst case) is a quadratic algorithm -- not good when the input vector is large. The following patch merges all consecutive ranges and removes the quadratic behavior. The implementation uses an auxiliary vector of indices in order to remember all ranges that can be dropped, then performs the coalescing of ranges in a single pass. Patch from Stephen Wilson with some minor modification by me. llvm-svn: 129595
* Forgot to check in this change with ↵Johnny Chen2011-04-151-1/+3
| | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=129542. llvm-svn: 129574
* Rewording of assert message.Johnny Chen2011-04-141-1/+1
| | | | llvm-svn: 129543
* Add a test to check that lldb reliably catches a crashing inferior (both ↵Johnny Chen2011-04-143-0/+92
| | | | | | command and Python API). llvm-svn: 129542
* Updated LLVM to pick up fixes to the ARM instructionSean Callanan2011-04-144-3/+23
| | | | | | tables. llvm-svn: 129500
* Added auto completion for architecture names and for platforms.Greg Clayton2011-04-1324-932/+926
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Modified the OptionGroupOptions to be able to specify only some of the options that should be appended by using the usage_mask in the group defintions and also provided a way to remap them to a new usage mask after the copy. This allows options to be re-used and also targetted for specific option groups. Modfied the CommandArgumentType to have a new eArgTypePlatform enumeration. Taught the option parser to be able to automatically use the appropriate auto completion for a given options if nothing is explicitly specified in the option definition. So you don't have to specify it in the option definition tables. Renamed the default host platform name to "host", and the default platform hostname to be "localhost". Modified the "file" and "platform select" commands to make sure all options and args are good prior to creating a new platform. Also defer the computation of the architecture in the file command until all options are parsed and the platform has either not been specified or reset to a new value to avoid computing the arch more than once. Switch the PluginManager code over to using llvm::StringRef for string comparisons and got rid of all the AccessorXXX functions in lieu of the newer mutex + collection singleton accessors. llvm-svn: 129483
* Fix bug where source & target registers were swapped in anCaroline Tice2011-04-131-2/+2
| | | | | | emulation function. llvm-svn: 129474
* Have "-h" print just the command arguments, and "-h -v" print the examples ↵Jim Ingham2011-04-131-2/+11
| | | | | | as well. llvm-svn: 129470
* Fix various minor bugs in the ARM instruction emulation code.Caroline Tice2011-04-131-2/+11
| | | | llvm-svn: 129422
* Revert newer xcscheme project file to avoid conflict with older XcodeGreg Clayton2011-04-131-4/+1
| | | | | | versions. llvm-svn: 129416
* Added two new classes for command options:Greg Clayton2011-04-1332-328/+625
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lldb_private::OptionGroup lldb_private::OptionGroupOptions OptionGroup lets you define a class that encapsulates settings that you want to reuse in multiple commands. It contains only the option definitions and the ability to set the option values, but it doesn't directly interface with the lldb_private::Options class that is the front end to all of the CommandObject option parsing. For that the OptionGroupOptions class can be used. It aggregates one or more OptionGroup objects and directs the option setting to the appropriate OptionGroup class. For an example of this, take a look at the CommandObjectFile and how it uses its "m_option_group" object shown below to be able to set values in both the FileOptionGroup and PlatformOptionGroup classes. The members used in CommandObjectFile are: OptionGroupOptions m_option_group; FileOptionGroup m_file_options; PlatformOptionGroup m_platform_options; Then in the constructor for CommandObjectFile you can combine the option settings. The code below shows a simplified version of the constructor: CommandObjectFile::CommandObjectFile(CommandInterpreter &interpreter) : CommandObject (...), m_option_group (interpreter), m_file_options (), m_platform_options(true) { m_option_group.Append (&m_file_options); m_option_group.Append (&m_platform_options); m_option_group.Finalize(); } We append the m_file_options and then the m_platform_options and then tell the option group the finalize the results. This allows the m_option_group to become the organizer of our prefs and after option parsing we end up with valid preference settings in both the m_file_options and m_platform_options objects. This also allows any other commands to use the FileOptionGroup and PlatformOptionGroup classes to implement options for their commands. Renamed: virtual void Options::ResetOptionValues(); to: virtual void Options::OptionParsingStarting(); And implemented a new callback named: virtual Error Options::OptionParsingFinished(); This allows Options subclasses to verify that the options all go together after all of the options have been specified and gives the chance for the command object to return an error. It also gives a chance to take all of the option values and produce or initialize objects after all options have completed parsing. Modfied: virtual Error SetOptionValue (int option_idx, const char *option_arg) = 0; to be: virtual Error SetOptionValue (uint32_t option_idx, const char *option_arg) = 0; (option_idx is now unsigned). llvm-svn: 129415
* Moved the execution context that was in the Debugger intoGreg Clayton2011-04-1269-1256/+3408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the CommandInterpreter where it was always being used. Make sure that Modules can track their object file offsets correctly to allow opening of sub object files (like the "__commpage" on darwin). Modified the Platforms to be able to launch processes. The first part of this move is the platform soon will become the entity that launches your program and when it does, it uses a new ProcessLaunchInfo class which encapsulates all process launching settings. This simplifies the internal APIs needed for launching. I want to slowly phase out process launching from the process classes, so for now we can still launch just as we used to, but eventually the platform is the object that should do the launching. Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able to launch processes with all of the new eLaunchFlag settings. Modified any code that was manually launching processes to use the Host::LaunchProcess functions. Fixed an issue where lldb_private::Args had implicitly defined copy constructors that could do the wrong thing. This has now been fixed by adding an appropriate copy constructor and assignment operator. Make sure we don't add empty ModuleSP entries to a module list. Fixed the commpage module creation on MacOSX, but we still need to train the MacOSX dynamic loader to not get rid of it when it doesn't have an entry in the all image infos. Abstracted many more calls from in ProcessGDBRemote down into the GDBRemoteCommunicationClient subclass to make the classes cleaner and more efficient. Fixed the default iOS ARM register context to be correct and also added support for targets that don't support the qThreadStopInfo packet by selecting the current thread (only if needed) and then sending a stop reply packet. Debugserver can now start up with a --unix-socket (-u for short) and can then bind to port zero and send the port it bound to to a listening process on the other end. This allows the GDB remote platform to spawn new GDB server instances (debugserver) to allow platform debugging. llvm-svn: 129351
* Added a few more commands, but I mainly wanted to include how to run lldbGreg Clayton2011-04-121-3/+86
| | | | | | | with the same program arguments for a process over and over without having to specify them (like you can with gdb with the "--args" option). llvm-svn: 129332
OpenPOWER on IntegriCloud