summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
Commit message (Collapse)AuthorAgeFilesLines
...
* Modified LLDB expressions to not have to JIT and run code just to see variableGreg Clayton2010-12-141-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | values or persistent expression variables. Now if an expression consists of a value that is a child of a variable, or of a persistent variable only, we will create a value object for it and make a ValueObjectConstResult from it to freeze the value (for program variables only, not persistent variables) and avoid running JITed code. For everything else we still parse up and JIT code and run it in the inferior. There was also a lot of clean up in the expression code. I made the ClangExpressionVariables be stored in collections of shared pointers instead of in collections of objects. This will help stop a lot of copy constructors on these large objects and also cleans up the code considerably. The persistent clang expression variables were moved over to the Target to ensure they persist across process executions. Added the ability for lldb_private::Target objects to evaluate expressions. We want to evaluate expressions at the target level in case we aren't running yet, or we have just completed running. We still want to be able to access the persistent expression variables between runs, and also evaluate constant expressions. Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects can now dump their contents with the UUID, arch and full paths being logged with appropriate prefix values. Thread hardened the Communication class a bit by making the connection auto_ptr member into a shared pointer member and then making a local copy of the shared pointer in each method that uses it to make sure another thread can't nuke the connection object while it is being used by another thread. Added a new file to the lldb/test/load_unload test that causes the test a.out file to link to the libd.dylib file all the time. This will allow us to test using the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else. llvm-svn: 121745
* Various fixes mostly relating to the User Settings stuff:Caroline Tice2010-12-101-7/+33
| | | | | | | | | | | | | | | | | - Added new utility function to Arg, GetQuotedCommandString, which re-assembles the args into a string, replacing quotes that were originally there. - Modified user settings stuff to always show individual elements when printing out arrays and dictionaries. - Added more extensive help to 'settings set', explaining more about dictionaries and arrays (including current dictionary syntax). - Fixed bug in user settings where quotes were being stripped and lost, so that sometimes array or dictionary elements that ought to have been a single element were being split up. llvm-svn: 121438
* Modify HandleCommand to not do any argument processing until it has ↵Caroline Tice2010-12-091-2/+131
| | | | | | | | | | | | | | | | determined whether or not the command should take raw input, then handle & dispatch the arguments appropriately. Also change the 'alias' command to be a command that takes raw input. This is necessary to allow aliases to be created for other commands that take raw input and might want to include raw input in the alias itself. Fix a bug in the aliasing mechanism when creating aliases for commands with 3-or-more words. Raw input should now be properly handled by all the command and alias mechanisms. llvm-svn: 121423
* process launch now asks to kill the current process if it is alive, and if ↵Jim Ingham2010-12-091-8/+34
| | | | | | | | you affirm, does so for you. Also added #pragma mark for the command objects defined in the file. llvm-svn: 121396
* Added the ability to dump sections to a certain depth (for when sectionsGreg Clayton2010-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | have children sections). Modified SectionLoadList to do it's own multi-threaded protected on its map. The ThreadSafeSTLMap class was difficult to deal with and wasn't providing much utility, it was only getting in the way. Make sure when the communication read thread is about to exit, it clears the thread in the main class. Fixed the ModuleList to correctly ignore architectures and UUIDs if they aren't valid when searching for a matching module. If we specified a file with no arch, and then modified the file and loaded it again, it would not match on subsequent searches if the arch was invalid since it would compare an invalid architecture to the one that was found or selected within the shared library or executable. This was causing stale modules to stay around in the global module list when they should have been removed. Removed deprecated functions from the DynamicLoaderMacOSXDYLD class. Modified "ProcessGDBRemote::IsAlive" to check if we are connected to a gdb server and also make sure our process hasn't exited. llvm-svn: 121236
* - Fix alias-building & resolving to properly handle optional arguments for ↵Caroline Tice2010-12-072-3/+9
| | | | | | | | | | | | | | | | | | command options. - Add logging for command resolution ('log enable lldb commands') - Fix alias resolution to properly handle commands that take raw input (resolve the alias, but don't muck up the raw arguments). Net result: Among other things, 'expr' command can now take strings with escaped characters and not have the command handling & alias resolution code muck up the escaped characters. E.g. 'expr printf ("\n\n\tHello there!")' should now work properly. Not working yet: Creating aliases with raw input for commands that take raw input. Working on that. e.g. 'command alias print_hi expr printf ("\n\tHi!")' does not work yet. llvm-svn: 121171
* Documentation fix - explain how to unset conditions. Also fix unsetting -x ↵Jim Ingham2010-12-032-12/+38
| | | | | | and -t so they work. llvm-svn: 120851
* Document the fact that "breakpoint modify" with no breakpoint acts on the Jim Ingham2010-12-031-1/+2
| | | | | | last created breakpoint. llvm-svn: 120850
* Add '-no-stdio' option to 'process launch' command, which causes theCaroline Tice2010-12-031-7/+25
| | | | | | | | | | inferior to be launched without setting up terminal stdin/stdout for it (leaving the lldb command line accessible while the program is executing). Also add a user settings variable, 'target.process.disable-stdio' to allow the user to set this globally rather than having to use the command option each time the process is launched. llvm-svn: 120825
* Make CommandObjectMultiword::GetSubcommandSP() more robust by appending theJohnny Chen2010-12-011-1/+5
| | | | | | exactly-matched sub_cmd to the passed in 'matches' string list. llvm-svn: 120516
* GetCommandObject returns no matches in the match array when there is only ↵Jim Ingham2010-12-011-1/+1
| | | | | | one match. That's odd, but I don't want to change that right now, just cope with it where I'm doing the command matching. llvm-svn: 120511
* Fix completion for multi-word commands in the "help" command.Jim Ingham2010-11-301-7/+29
| | | | llvm-svn: 120484
* Moved the code in ClangUserExpression that set up & ran the thread plan with ↵Jim Ingham2010-11-302-4/+16
| | | | | | | | | | timeouts, and restarting with all threads into a utility function in Process. This required a bunch of renaming. Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it. Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened. llvm-svn: 120386
* Add the ability to catch and do the right thing with Interrupts (often ↵Caroline Tice2010-11-192-0/+34
| | | | | | | | control-c) and end-of-file (often control-d). llvm-svn: 119837
* Added the address of operator for the "frame variable" command. Greg Clayton2010-11-151-12/+25
| | | | llvm-svn: 119100
* Just like functions can have a basename and a mangled/demangled name, variableGreg Clayton2010-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | can too. So now the lldb_private::Variable class has support for this. Variables now have support for having a basename ("i"), and a mangled name ("_ZN12_GLOBAL__N_11iE"), and a demangled name ("(anonymous namespace)::i"). Nowwhen searching for a variable by name, users might enter the fully qualified name, or just the basename. So new test functions were added to the Variable and Mangled classes as: bool NameMatches (const ConstString &name); bool NameMatches (const RegularExpression &regex); I also modified "ClangExpressionDeclMap::FindVariableInScope" to also search for global variables that are not in the current file scope by first starting with the current module, then moving on to all modules. Fixed an issue in the DWARF parser that could cause a varaible to get parsed more than once. Now, once we have parsed a VariableSP for a DIE, we cache the result even if a variable wasn't made so we don't do any re-parsing. Some DW_TAG_variable DIEs don't have locations, or are missing vital info that stops a debugger from being able to display anything for it, we parse a NULL variable shared pointer for these DIEs so we don't keep trying to reparse it. llvm-svn: 119085
* Modified the lldb_private::Type clang type resolving code to handle threeGreg Clayton2010-11-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | cases when getting the clang type: - need only a forward declaration - need a clang type that can be used for layout (members and args/return types) - need a full clang type This allows us to partially parse the clang types and be as lazy as possible. The first case is when we just need to declare a type and we will complete it later. The forward declaration happens only for class/union/structs and enums. The layout type allows us to resolve the full clang type _except_ if we have any modifiers on a pointer or reference (both R and L value). In this case when we are adding members or function args or return types, we only need to know how the type will be laid out and we can defer completing the pointee type until we later need it. The last type means we need a full definition for the clang type. Did some renaming of some enumerations to get rid of the old "DC" prefix (which stands for DebugCore which is no longer around). Modified the clang namespace support to be almost ready to be fed to the expression parser. I made a new ClangNamespaceDecl class that can carry around the AST and the namespace decl so we can copy it into the expression AST. I modified the symbol vendor and symbol file plug-ins to use this new class. llvm-svn: 118976
* Silence a bunch of clang warnings.Benjamin Kramer2010-11-101-1/+1
| | | | llvm-svn: 118710
* Added the equivalent of gdb's "unwind-on-signal" to the expression command, ↵Jim Ingham2010-11-052-2/+12
| | | | | | and a parameter to control it in ClangUserExpression, and on down to ClangFunction. llvm-svn: 118290
* Added a setting to "log timer" so you can see the incremental timings as well:Jim Ingham2010-11-041-1/+13
| | | | | | log timer increment true/false llvm-svn: 118268
* Added a top level Timer to the interpreter execute command. Also added an ↵Jim Ingham2010-11-041-1/+19
| | | | | | | | | | option to pass the depth to "log timer enable". That allows you to time just command execution with: log timer enable 1 <command> log timer dump llvm-svn: 118266
* Revert last checking to CommandObjectDisassemble.cpp; that wasJason Molenda2010-11-041-48/+1
| | | | | | | some diagnostic test code I was using while debugging the native unwinder and didn't mean to check in. llvm-svn: 118241
* Built the native unwinder with all the warnings c++-4.2 could muster;Jason Molenda2010-11-041-1/+48
| | | | | | | | | fixed them. Added DISALLOW_COPY_AND_ASSIGN to classes that should not be bitwise copied. Added default initializers for member variables that weren't being initialized in the ctor. Fixed a few shadowed local variable mistakes. llvm-svn: 118240
* Added support for loading and unloading shared libraries. This was done byGreg Clayton2010-11-042-15/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding support into lldb_private::Process: virtual uint32_t lldb_private::Process::LoadImage (const FileSpec &image_spec, Error &error); virtual Error lldb_private::Process::UnloadImage (uint32_t image_token); There is a default implementation that should work for both linux and MacOSX. This ability has also been exported through the SBProcess API: uint32_t lldb::SBProcess::LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error); lldb::SBError lldb::SBProcess::UnloadImage (uint32_t image_token); Modified the DynamicLoader plug-in interface to require it to be able to tell us if it is currently possible to load/unload a shared library: virtual lldb_private::Error DynamicLoader::CanLoadImage () = 0; This way the dynamic loader plug-ins are allows to veto whether we can currently load a shared library since the dynamic loader might know if it is currenlty loading/unloading shared libraries. It might also know about the current host system and know where to check to make sure runtime or malloc locks are currently being held. Modified the expression parser to have ClangUserExpression::Evaluate() be the one that causes the dynamic checkers to be loaded instead of other code that shouldn't have to worry about it. llvm-svn: 118227
* Fix error message when attempting to generate invalid alias.Caroline Tice2010-11-021-14/+3
| | | | llvm-svn: 118036
* Fixed a missing newline when you type "apropos somethingthatdoesnotexist".Greg Clayton2010-11-021-1/+1
| | | | llvm-svn: 118033
* Fix problem where "process detach" was not working properly. TheCaroline Tice2010-11-021-0/+1
| | | | | | | | | | ptrace thread update that was replying to the SIGSTOP was also causing the process to not really be sigstop'd any more so then the call to ptrace detach was failing, and when debugserver exited the attached process was being killed. Now the ptrace thread update does not disturb the sigstop state of the thread, so the detach works properly. llvm-svn: 118018
* Fixed the default file and line breakpoints to include inlined breakpoints.Greg Clayton2010-11-022-4/+4
| | | | llvm-svn: 118002
* These two casts are up casts, no need to use dynamic_cast.Johnny Chen2010-10-291-1/+1
| | | | llvm-svn: 117725
* Update arguments & help information for "log disable" command.Caroline Tice2010-10-291-5/+13
| | | | llvm-svn: 117717
* Add the ability to disable individual log categories, ratherCaroline Tice2010-10-291-20/+18
| | | | | | | | | than just the entire log channel. Add checks, where appropriate, to make sure a log channel/category has not been disabled before attempting to write to it. llvm-svn: 117715
* The r117616 check in broken these two test cases:Johnny Chen2010-10-291-1/+7
| | | | | | | | | | | | | | 1. FoundationDisassembleTestCase.test_simple_disasm_with_dsym; and 2. FoundationDisassembleTestCase.test_simple_disasm_with_dwarf the reason being the test was issuing 'disassemble' command to disassemble the current frame function when stopped. The 'disassemble' command worked previously but it was a result of bad option specification. Fix the disassemble command so that it will require 'disassemble -f' for disassembly of the current frame function. llvm-svn: 117688
* Added a user-settable variable, 'target.expr-prefix',Sean Callanan2010-10-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which holds the name of a file whose contents are prefixed to each expression. For example, if the file ~/lldb.prefix.header contains: typedef unsigned short my_type; then you can do this: (lldb) settings set target.expr-prefix '~/lldb.prefix.header' (lldb) expr sizeof(my_type) (unsigned long) $0 = 2 When the variable is changed, the corresponding file is loaded and its contents are fetched into a string that is stored along with the target. This string is then passed to each expression and inserted into it during parsing, like this: typedef unsigned short my_type; void $__lldb_expr(void *$__lldb_arg) { sizeof(my_type); } llvm-svn: 117627
* Add alias information, including aliased command options & Caroline Tice2010-10-282-0/+11
| | | | | | arguments, to help text for alias commands. llvm-svn: 117617
* Comment out uninmplemented command option (-f) for disassembleCaroline Tice2010-10-281-1/+1
| | | | | | command. llvm-svn: 117616
* Check in an initial implementation of the "breakpoint clear" command, whose ↵Johnny Chen2010-10-282-5/+254
| | | | | | | | | | | | | | | | | | | | purpose is clear the breakpoint associated with the (filename, line_number) combo when an arrow is pointing to a source position using Emacs Grand Unified Debugger library to interact with lldb. The current implmentation is insufficient in that it only asks the breakpoint whether it is associated with a breakpoint resolver with FileLine type and whether it matches the (filename, line_number) combo. There are other breakpoint resolver types whose breakpoint locations can potentially match the (filename, line_number) combo. The BreakpointResolver, BreakpointResolverName, BreakpointResolverAddress, and BreakpointResolverFileLine classes have extra static classof methods to support LLVM style type inquiry through isa, cast, and dyn_cast. The Breakpoint class has an API method bool GetMatchingFileLine(...) which is invoked from CommandObjectBreak.cpp to implement the "breakpoint clear" command. llvm-svn: 117562
* Add warning if no actual locations were resolved when attemptingCaroline Tice2010-10-281-0/+11
| | | | | | to set a breakpoint. llvm-svn: 117555
* Fixed the "frame variable -G NAME" that would print globalGreg Clayton2010-10-281-1/+1
| | | | | | | | variables by name. It was accidentally getting all the globals for the compile unit that contained the global variable named NAME. llvm-svn: 117516
* Flush the prompts immediately in the breakpoint command input readers, to make Caroline Tice2010-10-271-0/+7
| | | | | | sure they come out at the correct times. llvm-svn: 117470
* First pass at adding logging capabilities for the API functions. At the momentCaroline Tice2010-10-261-3/+12
| | | | | | | | | | | | | | | | | | it logs the function calls, their arguments and the return values. This is not complete or polished, but I am committing it now, at the request of someone who really wants to use it, even though it's not really done. It currently does not attempt to log all the functions, just the most important ones. I will be making further adjustments to the API logging code over the next few days/weeks. (Suggestions for improvements are welcome). Update the Python build scripts to re-build the swig C++ file whenever the python-extensions.swig file is modified. Correct the help for 'log enable' command (give it the correct number & type of arguments). llvm-svn: 117349
* Add an extra SPC character after '.' for the 'frame variable' help text.Johnny Chen2010-10-251-1/+1
| | | | llvm-svn: 117330
* Fixed a crasher. The cmd_file needs to be resolved before reading lines ↵Johnny Chen2010-10-201-1/+1
| | | | | | from it. llvm-svn: 116948
* Fixed an issue where we were resolving paths when we should have been.Greg Clayton2010-10-207-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So the issue here was that we have lldb_private::FileSpec that by default was always resolving a path when using the: FileSpec::FileSpec (const char *path); and in the: void FileSpec::SetFile(const char *pathname, bool resolve = true); This isn't what we want in many many cases. One example is you have "/tmp" on your file system which is really "/private/tmp". You compile code in that directory and end up with debug info that mentions "/tmp/file.c". Then you type: (lldb) breakpoint set --file file.c --line 5 If your current working directory is "/tmp", then "file.c" would be turned into "/private/tmp/file.c" which won't match anything in the debug info. Also, it should have been just a FileSpec with no directory and a filename of "file.c" which could (and should) potentially match any instances of "file.c" in the debug info. So I removed the constructor that just takes a path: FileSpec::FileSpec (const char *path); // REMOVED You must now use the other constructor that has a "bool resolve" parameter that you must always supply: FileSpec::FileSpec (const char *path, bool resolve); I also removed the default parameter to SetFile(): void FileSpec::SetFile(const char *pathname, bool resolve); And fixed all of the code to use the right settings. llvm-svn: 116944
* Ok, last commit for the running processes in a new window. Now you can Greg Clayton2010-10-191-3/+10
| | | | | | | | | | | | optionally specify the tty you want to use if you want to use an existing terminal window by giving a partial or full path name: (lldb) process launch --tty=ttys002 This would find the terminal window (or tab on MacOSX) that has ttys002 in its tty path and use it. If it isn't found, it will use a new terminal window. llvm-svn: 116878
* Stop the driver from handling SIGPIPE in case we communicate with stale Greg Clayton2010-10-191-22/+7
| | | | | | | | | | | | | | | | | | | | sockets so the driver doesn't just crash. Added support for connecting to named sockets (unix IPC sockets) in ConnectionFileDescriptor. Modified the Host::LaunchInNewTerminal() for MacOSX to return the process ID of the inferior process instead of the process ID of the Terminal.app. This was done by modifying the "darwin-debug" executable to connect to lldb through a named unix socket which is passed down as an argument. This allows a quick handshake between "lldb" and "darwin-debug" so we can get the process ID of the inferior and then attach by process ID and avoid attaching to the inferior by process name since there could be more than one process with that name. This still has possible race conditions, those will be fixed in the near future. This fixes the SIGPIPE issues that were sometimes being seen when task_for_pid was failing. llvm-svn: 116792
* Combine eArgTypeSignalName and eArgTypeUnixSignalNumber into a singleCaroline Tice2010-10-181-5/+5
| | | | | | argument type, eArgTypeUnixSignal. llvm-svn: 116764
* Fixed debugserver to properly attach to a process by name with the Greg Clayton2010-10-182-42/+101
| | | | | | | | | | | | | | | | | | | "vAttachName;<PROCNAME>" packet, and wait for a new process by name to launch with the "vAttachWait;<PROCNAME>". Fixed a few issues with attaching where if DoAttach() returned no error, yet there was no valid process ID, we would deadlock waiting for an event that would never happen. Added a new "process launch" option "--tty" that will launch the process in a new terminal if the Host layer supports the "Host::LaunchInNewTerminal(...)" function. This currently works on MacOSX and will allow the debugging of terminal applications that do complex operations with the terminal. Cleaned up the output when the process resumes, stops and halts to be consistent with the output format. llvm-svn: 116693
* Disable "process.macosx" plugin, since it is not being actively supportedCaroline Tice2010-10-151-1/+1
| | | | | | at the moment, and no longer works properly (bit rot). llvm-svn: 116626
* Added support for breakpoint conditions. I also had to separate the "run ↵Jim Ingham2010-10-142-18/+45
| | | | | | | | the expression" part of ClangFunction::Execute from the "Gather the expression result" so that in the case of the Breakpoint condition I can move the condition evaluation into the normal thread plan processing. Also added support for remembering the "last set breakpoint" so that "break modify" will act on the last set breakpoint. llvm-svn: 116542
* Fixed an expression parsing issue where if you were stopped somewhere withoutGreg Clayton2010-10-142-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | debug information and you evaluated an expression, a crash would occur as a result of an unchecked pointer. Added the ability to get the expression path for a ValueObject. For a rectangle point child "x" the expression path would be something like: "rect.top_left.x". This will allow GUI and command lines to get ahold of the expression path for a value object without having to explicitly know about the hierarchy. This means the ValueObject base class now has a "ValueObject *m_parent;" member. All ValueObject subclasses now correctly track their lineage and are able to provide value expression paths as well. Added a new "--flat" option to the "frame variable" to allow for flat variable output. An example of the current and new outputs: (lldb) frame variable argc = 1 argv = 0x00007fff5fbffe80 pt = { x = 2 y = 3 } rect = { bottom_left = { x = 1 y = 2 } top_right = { x = 3 y = 4 } } (lldb) frame variable --flat argc = 1 argv = 0x00007fff5fbffe80 pt.x = 2 pt.y = 3 rect.bottom_left.x = 1 rect.bottom_left.y = 2 rect.top_right.x = 3 rect.top_right.y = 4 As you can see when there is a lot of hierarchy it can help flatten things out. Also if you want to use a member in an expression, you can copy the text from the "--flat" output and not have to piece it together manually. This can help when you want to use parts of the STL in expressions: (lldb) frame variable --flat argc = 1 argv = 0x00007fff5fbffea8 hello_world._M_dataplus._M_p = 0x0000000000000000 (lldb) expr hello_world._M_dataplus._M_p[0] == '\0' llvm-svn: 116532
OpenPOWER on IntegriCloud