summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
Commit message (Collapse)AuthorAgeFilesLines
* Fixed an lldb infrastructure bug, where the debugger should reaaly update itsJohnny Chen2010-09-031-1/+1
| | | | | | | | | | | execution context only when the process is still alive. When running the test suite, the debugger is launching and killing processes constantly. This might be the cause of the test hang as reported in rdar://problem/8377854, where the debugger was looping infinitely trying to update a supposedly stale thread list. llvm-svn: 113022
* Added a new bool parameter to many of the DumpStopContext() methods that Greg Clayton2010-09-022-4/+4
| | | | | | | | | | | | | | | | | might dump file paths that allows the dumping of full paths or just the basenames. Switched the stack frame dumping code to use just the basenames for the files instead of the full path. Modified the StackID class to no rely on needing the start PC for the current function/symbol since we can use the SymbolContextScope to uniquely identify that, unless there is no symbol context scope. In that case we can rely upon the current PC value. This saves the StackID from having to calculate the start PC when the StackFrame::GetStackID() accessor is called. Also improved the StackID less than operator to correctly handle inlined stack frames in the same stack. llvm-svn: 112867
* StackFrame objects now own ValueObjects for any frame variables (locals, args,Greg Clayton2010-09-023-39/+68
| | | | | | | | | | | | | | | | | | | | function statics, file globals and static variables) that a frame contains. The StackFrame objects can give out ValueObjects instances for each variable which allows us to track when a variable changes and doesn't depend on variable names when getting value objects. StackFrame::GetVariableList now takes a boolean to indicate if we want to get the frame compile unit globals and static variables. The value objects in the stack frames can now correctly track when they have been modified. There are a few more tweaks needed to complete this work. The biggest issue is when stepping creates partial stacks (just frame zero usually) and causes previous stack frames not to match up with the current stack frames because the previous frames only has frame zero. We don't really want to require that all previous frames be complete since stepping often must check stack frames to complete their jobs. I will fix this issue tomorrow. llvm-svn: 112800
* Don't re-look up the symbol in ResolveSymbolContextForAddress.Jim Ingham2010-08-311-2/+2
| | | | llvm-svn: 112679
* Added a way to open the current source file & line in an external editor, ↵Jim Ingham2010-08-301-1/+2
| | | | | | | | and you can turn this on with: lldb -e llvm-svn: 112502
* Clarified the intent of the SymbolContextScope class in the headerGreg Clayton2010-08-301-9/+0
| | | | | | | | | | | | | documentation. Symbol now inherits from the symbol context scope so that the StackID can use a "SymbolContextScope *" instead of a blockID (which could have been the same as some other blockID from another symbol file). Modified the stacks that are created on subsequent stops to reuse the previous stack frame objects which will allow for some internal optimization using pointer comparisons during stepping. llvm-svn: 112495
* Detect when ValueObject values change each time they are evaluated.Greg Clayton2010-08-281-3/+33
| | | | llvm-svn: 112331
* Made it so we update the current frames from the previous frames by doing STLGreg Clayton2010-08-271-0/+6
| | | | | | | | swaps on the variable list, value object list, and disassembly. This avoids us having to try and update frame indexes and other things that were getting out of sync. llvm-svn: 112301
* Change "Current" as in GetCurrentThread, GetCurrentStackFrame, etc, to ↵Jim Ingham2010-08-261-10/+10
| | | | | | "Selected" i.e. GetSelectedThread. Selected makes more sense, since these are set by some user action (a selection). I didn't change "CurrentProcess" since this is always controlled by the target, and a given target can only have one process, so it really can't be selected. llvm-svn: 112221
* Fixed another issue with the inline stack frames where if the first frameGreg Clayton2010-08-241-49/+0
| | | | | | | | | | | | has inlined functions that all started at the same address, then the inlined backtrace would not produce correct stack frames. Also cleaned up and inlined a lot of stuff in lldb_private::Address. Added a function to StackFrame to detect if the frame is a concrete frame so we can detect the difference between actual frames and inlined frames. llvm-svn: 111989
* Got a lot of the kinks worked out in the inline support after debugging moreGreg Clayton2010-08-242-3/+3
| | | | | | | | | | | | | | | | | | | | | | complex inlined examples. StackFrame classes don't have a "GetPC" anymore, they have "GetFrameCodeAddress()". This is because inlined frames will have a PC value that is the same as the concrete frame that owns the inlined frame, yet the code locations for the frame can be different. We also need to be able to get the real PC value for a given frame so that variables evaluate correctly. To get the actual PC value for a frame you can use: addr_t pc = frame->GetRegisterContext()->GetPC(); Some issues with the StackFrame stomping on its own symbol context were resolved which were causing the information to change for a frame when the stack ID was calculated. Also the StackFrame will now correctly store the symbol context resolve flags for any extra bits of information that were looked up (if you ask for a block only and you find one, you will alwasy have the compile unit and function). llvm-svn: 111964
* Added support for inlined stack frames being represented as real stack framesGreg Clayton2010-08-243-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which is now on by default. Frames are gotten from the unwinder as concrete frames, then if inline frames are to be shown, extra information to track and reconstruct these frames is cached with each Thread and exanded as needed. I added an inline height as part of the lldb_private::StackID class, the class that helps us uniquely identify stack frames. This allows for two frames to shared the same call frame address, yet differ only in inline height. Fixed setting breakpoint by address to not require addresses to resolve. A quick example: % cat main.cpp % ./build/Debug/lldb test/stl/a.out Current executable set to 'test/stl/a.out' (x86_64). (lldb) breakpoint set --address 0x0000000100000d31 Breakpoint created: 1: address = 0x0000000100000d31, locations = 1 (lldb) r Launching 'a.out' (x86_64) (lldb) Process 38031 Stopped * thread #1: tid = 0x2e03, pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280, stop reason = breakpoint 1.1, queue = com.apple.main-thread 277 278 _CharT* 279 _M_data() const 280 -> { return _M_dataplus._M_p; } 281 282 _CharT* 283 _M_data(_CharT* __p) (lldb) bt thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread frame #0: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280 frame #1: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_rep() const at /usr/include/c++/4.2.1/bits/basic_string.h:288 frame #2: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::size() const at /usr/include/c++/4.2.1/bits/basic_string.h:606 frame #3: pc = 0x0000000100000d31, where = a.out`main [inlined] operator<< <char, std::char_traits<char>, std::allocator<char> > at /usr/include/c++/4.2.1/bits/basic_string.h:2414 frame #4: pc = 0x0000000100000d31, where = a.out`main + 33 at /Volumes/work/gclayton/Documents/src/lldb/test/stl/main.cpp:14 frame #5: pc = 0x0000000100000d08, where = a.out`start + 52 Each inline frame contains only the variables that they contain and each inlined stack frame is treated as a single entity. llvm-svn: 111877
* Changed "Error Value::GetValueAsData (...)" to set the data extractor byte Greg Clayton2010-08-181-0/+9
| | | | | | | | | | order and address size correctly when the value comes from a file address. Values have "file" addresses when they are globals and the debug information specifies that they live in the object file at a given address (DWARF will represent this as a location "DW_OP_addr <addr>"). This causes global pointers to correctly extract their children on 64 bit programs. llvm-svn: 111380
* Change Target & Process so they can really be initialized with an invalid ↵Jim Ingham2010-08-091-1/+27
| | | | | | | | | | | | architecture. Arrange that this then gets properly set on attach, or when a "file" is set. Add a completer for "process attach -n". Caveats: there isn't currently a way to handle multiple processes with the same name. That will have to wait on a way to pass annotations along with the completion strings. llvm-svn: 110624
* Added FindTypes to Module and ModuleList.Greg Clayton2010-08-032-10/+35
| | | | llvm-svn: 110093
* Added support for objective C built-in types: id, Class, and SEL. This Greg Clayton2010-08-032-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | involved watching for the objective C built-in types in DWARF and making sure when we convert the DWARF types into clang types that we use the appropriate ASTContext types. Added a way to find and dump types in lldb (something equivalent to gdb's "ptype" command): image lookup --type <TYPENAME> This only works for looking up types by name and won't work with variables. It also currently dumps out verbose internal information. I will modify it to dump more appropriate user level info in my next submission. Hookup up the "FindTypes()" functions in the SymbolFile and SymbolVendor so we can lookup types by name in one or more images. Fixed "image lookup --address <ADDRESS>" to be able to correctly show all symbol context information, but it will only show this extra information when the new "--verbose" flag is used. Updated to latest LLVM to get a few needed fixes. llvm-svn: 110089
* Created lldb::LanguageType by moving an enumeration from the Greg Clayton2010-07-281-6/+6
| | | | | | | | | | | | lldb_private::Language class into the enumerations header so it can be freely used by other interfaces. Added correct objective C class support to the DWARF symbol parser. Prior to this fix we were parsing objective C classes as C++ classes and now that the expression parser is ready to call functions we need to make sure the objective C classes have correct AST types. llvm-svn: 109574
* Changed SymbolContext so when you search for functionsSean Callanan2010-07-272-3/+7
| | | | | | | | | | | | | | | | | | it returns a list of functions as a SymbolContextList. Rewrote the clients of SymbolContext to use this SymbolContextList. Rewrote some of the providers of the data to SymbolContext to make them respect preferences as to whether the list should be cleared first; propagated that change out. ClangExpressionDeclMap and ClangASTSource use this new function list to properly generate function definitions - even for functions that don't have a prototype in the debug information. llvm-svn: 109476
* Remove a premature invalidation of a threads pthread_t handle, thus avoidingGreg Clayton2010-07-231-3/+3
| | | | | | | | | a segfault when calling pthread_cancel. Also, sets m_read_thread_enabled if the thread is actually spawned. Patch from Stephen Wilson. llvm-svn: 109227
* Warnings cleanup patch from Jean-Daniel Dupas.Greg Clayton2010-07-231-4/+4
| | | | llvm-svn: 109226
* Modified both the ObjectFileMachO and ObjectFileELF to correctly set theGreg Clayton2010-07-211-1/+7
| | | | | | | | | | | | | SectionType for Section objects for DWARF. Modified the DWARF plug-in to get the DWARF sections by SectionType so we can safely abstract the LLDB core from section names for the various object file formats. Modified the SectionType definitions for .debug_pubnames and .debug_pubtypes to use the correct case. llvm-svn: 109054
* Change over to using the definitions for mach-o types and defines to theGreg Clayton2010-07-214-16/+20
| | | | | | | | | | | defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO and ObjectContainerUniversalMachO to be able to be cross compiled in Linux. Also did some cleanup on the ASTType by renaming it to ClangASTType and renaming the header file. Moved a lot of "AST * + opaque clang type *" functionality from lldb_private::Type over into ClangASTType. llvm-svn: 109046
* Allow searching for a section by SectionType.Greg Clayton2010-07-212-1/+18
| | | | llvm-svn: 109040
* Avoid std::bitset<64>::to_string() since it is missing in earlier C++ Greg Clayton2010-07-211-1/+7
| | | | | | libraries (from William Lynch). llvm-svn: 108976
* Remove use of STL collection class use of the "data()" method since it isn'tGreg Clayton2010-07-207-15/+15
| | | | | | | part of C++'98. Most of these were "std::vector<T>::data()" and "std::string::data()". llvm-svn: 108957
* I enabled some extra warnings for hidden local variables and for hiddenGreg Clayton2010-07-143-4/+1
| | | | | | virtual functions and caught some things and did some general code cleanup. llvm-svn: 108299
* A few more misc warning fixes.Eli Friedman2010-07-091-2/+2
| | | | llvm-svn: 108030
* Misc warning fixes.Eli Friedman2010-07-091-4/+4
| | | | llvm-svn: 108029
* Merged Eli Friedman's linux build changes where he added Makefile files thatGreg Clayton2010-07-0918-70/+106
| | | | | | | enabled LLVM make style building and made this compile LLDB on Mac OS X. We can now iterate on this to make the build work on both linux and macosx. llvm-svn: 108009
* Switch over to using llvm's dwarf constants file.Jason Molenda2010-07-062-17/+16
| | | | llvm-svn: 107716
* Remove extraneous semicolon after if condition (from Jean-Daniel Dupas).Greg Clayton2010-07-061-3/+3
| | | | llvm-svn: 107694
* Add const qualification; fixes error on gcc 4.4.Eli Friedman2010-07-021-1/+1
| | | | llvm-svn: 107499
* Added a method to get a stream's byte order.Sean Callanan2010-07-021-0/+10
| | | | llvm-svn: 107460
* Removed the thread specific data that was being used for demangling sinceGreg Clayton2010-07-021-55/+4
| | | | | | | | removing it didn't cause any performance loss, and leaks were showing up when run under instruments when we tried to re-use the buffer. We are now leak free and still just as performant. llvm-svn: 107453
* Added a missing static function prototype to FileSpec.h for ResolveUsername.Greg Clayton2010-07-011-10/+10
| | | | | | Did a bit of code formatting and cleanup. llvm-svn: 107403
* Moved the User Name expansion over to FileSpec, and converted it to use ↵Jim Ingham2010-07-011-9/+87
| | | | | | | | getpwname directly. Changed the file completion to deal with this, and FileSpec::Resolve now resolves all user names (not just ~/). llvm-svn: 107370
* Fixed up disassembly to not emit the module name before all function namesGreg Clayton2010-07-011-7/+16
| | | | | | | | | | | | that are in the disassembly comments since most of them are in the same module (shared library). Fixed a crasher that could happen when disassembling special section data. Added an address dump style that shows the symbol context without the module (used in the disassembly code). llvm-svn: 107366
* Centralized all disassembly into static functions in ↵Greg Clayton2010-06-304-128/+388
| | | | | | | | | | | | | | | | | | | | | | | | source/Core/Disassembler.cpp. Added the ability to read memory from the target's object files when we aren't running, so disassembling works before you run! Cleaned up the API to lldb_private::Target::ReadMemory(). Cleaned up the API to the Disassembler to use actual "lldb_private::Address" objects instead of just an "addr_t". This is nice because the Address objects when resolved carry along their section and module which can get us the object file. This allows Target::ReadMemory to be used when we are not running. Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext This will show a full breakdown of what an address points to. To see some sample output, execute a "image lookup --address <addr>". Fixed SymbolContext::DumpStopContext(...) to not require a live process in order to be able to print function and symbol offsets. llvm-svn: 107350
* Add a unique ID to each debugger instance.Caroline Tice2010-06-301-0/+21
| | | | | | | | | | | | | | | | | Add functions to look up debugger by id Add global variable to lldb python module, to hold debugger id Modify embedded Python interpreter to update the global variable with the id of its current debugger. Modify the char ** typemap definition in lldb.swig to accept 'None' (for NULL) as a valid value. The point of all this is so that, when you drop into the embedded interpreter from the command interpreter (or when doing Python-based breakpoint commands), there is a way for the Python side to find/get the correct debugger instance ( by checking debugger_unique_id, then calling SBDebugger::FindDebuggerWithID on it). llvm-svn: 107287
* Fixed debug map in executable + DWARF in .o debugging on Mac OS X.Greg Clayton2010-06-282-121/+14
| | | | | | | | | Added the ability to dump any file in the global module cache using any of the "image dump" commands. This allows us to dump the .o files that are used with DWARF + .o since they don't belong the the target list for the current target. llvm-svn: 107100
* Added function name types to allow us to set breakpoints by name moreGreg Clayton2010-06-286-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intelligently. The four name types we currently have are: eFunctionNameTypeFull = (1 << 1), // The function name. // For C this is the same as just the name of the function // For C++ this is the demangled version of the mangled name. // For ObjC this is the full function signature with the + or // - and the square brackets and the class and selector eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class // methods or selectors will be searched. eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names this allows much more flexibility when setting breakoints: (lldb) breakpoint set --name main --basename (lldb) breakpoint set --name main --fullname (lldb) breakpoint set --name main --method (lldb) breakpoint set --name main --selector The default: (lldb) breakpoint set --name main will inspect the name "main" and look for any parens, or if the name starts with "-[" or "+[" and if any are found then a full name search will happen. Else a basename search will be the default. Fixed some command option structures so not all options are required when they shouldn't be. Cleaned up the breakpoint output summary. Made the "image lookup --address <addr>" output much more verbose so it shows all the important symbol context results. Added a GetDescription method to many of the SymbolContext objects for the more verbose output. llvm-svn: 107075
* Fixed the log streams for logs that output toSean Callanan2010-06-231-85/+0
| | | | | | standard output, resolving a crasher. llvm-svn: 106682
* Very large changes that were needed in order to allow multiple connectionsGreg Clayton2010-06-234-100/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to the debugger from GUI windows. Previously there was one global debugger instance that could be accessed that had its own command interpreter and current state (current target/process/thread/frame). When a GUI debugger was attached, if it opened more than one window that each had a console window, there were issues where the last one to setup the global debugger object won and got control of the debugger. To avoid this we now create instances of the lldb_private::Debugger that each has its own state: - target list for targets the debugger instance owns - current process/thread/frame - its own command interpreter - its own input, output and error file handles to avoid conflicts - its own input reader stack So now clients should call: SBDebugger::Initialize(); // (static function) SBDebugger debugger (SBDebugger::Create()); // Use which ever file handles you wish debugger.SetErrorFileHandle (stderr, false); debugger.SetOutputFileHandle (stdout, false); debugger.SetInputFileHandle (stdin, true); // main loop SBDebugger::Terminate(); // (static function) SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to ensure nothing gets destroyed too early when multiple clients might be attached. Cleaned up the command interpreter and the CommandObject and all subclasses to take more appropriate arguments. llvm-svn: 106615
* Turns out __cxa_demangle returns the size of the buffer instead of the size ofBenjamin Kramer2010-06-221-5/+2
| | | | | | the demangled name. Fall back to strlen. llvm-svn: 106579
* Reduce code duplication.Benjamin Kramer2010-06-221-17/+3
| | | | | | This also moves strlen out of the mutex scope. llvm-svn: 106545
* Ensure GetDemangledName's thread safety by making the demangle buffer thread ↵Benjamin Kramer2010-06-221-12/+54
| | | | | | | | | | | | | | | specific. I'm not sure when multiple threads enter this method but a race-condition causing a crash in malloc can be reproduced with this little script: echo file $(which lldb) > cmd echo "run\nbreak set -n main\nrun\nexit" >> cmd lldb -s cmd It may need a few runs before it crashes though. llvm-svn: 106544
* Move trivial parts of UserID into the header.Benjamin Kramer2010-06-221-48/+0
| | | | llvm-svn: 106535
* Move a bunch of trivial methods into the header. These compile down to 1-2Benjamin Kramer2010-06-212-56/+0
| | | | | | instructions so it's really profitable to inline them. llvm-svn: 106450
* Return false from FileSpec::GetPath early instead of making the return valueBenjamin Kramer2010-06-211-0/+4
| | | | | | dependent on the last byte of the buffer, which could be unitialized. llvm-svn: 106417
* Don't snprintf directly into a std::string, it's undefined behavior per C++03.Benjamin Kramer2010-06-211-12/+9
| | | | | | | | This also fixes a bug where we were trying to copy m_string into itself via a format string. The pointer was invalidated by m_string.resize and lldb (sometimes) crashed inside vsnprintf. llvm-svn: 106416
OpenPOWER on IntegriCloud