summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O
Commit message (Collapse)AuthorAgeFilesLines
...
* Enable all the new accelerator tables if they are present and don't manuallyGreg Clayton2011-10-041-0/+4
| | | | | | | | | | index the DWARF. Also fixed an issue with memory accelerator tables with a size of 1 where we would loop infinitely. Added support for parsing the new .apple_namespaces section which gives us a memory hash table for looking up namespaces. llvm-svn: 141128
* Convert over to the latest and greatest on disc acceleratorGreg Clayton2011-09-281-8/+8
| | | | | | | hash tables. Renamed the DWARF sections to ".apple_names" and ".apple_types" until we get more buy in from other vendors. llvm-svn: 140702
* The first part of a fix for being able to select an architecture slice fromGreg Clayton2011-09-211-0/+9
| | | | | | | | | | a file when the target has a triple with an unknown vendor and/or OS and the slice of the file itself has a valid vendor and/or OS. The Module now adopts the ObjectFile's architecture after a valid architecture has been loaded to make sure the module matches the object file. llvm-svn: 140236
* Update declarations for all functions/methods that accept printf-styleJason Molenda2011-09-201-1/+1
| | | | | | | | stdarg formats to use __attribute__ format so the compiler can flag incorrect uses. Fix all incorrect uses. Most of these are innocuous, a few were resulting in crashes. llvm-svn: 140185
* Added support for accessing and loading our new .debug_names and .debug_typesGreg Clayton2011-09-011-0/+8
| | | | | | | | | | | | | | | | | | DWARF accelerator table sections to the DWARF parser. These sections are similar to the .debug_pubnames and .debug_pubtypes, but they are designed to be hash tables that are saved to disc in a way that the sections can just be loaded into memory and used without any work on the debugger side. The .debug_pubnames and .debug_pubtypes sections are not ordered, contain a copy of the name in the section itself which makes these sections quite large, they only include publicly exported names (so no static functions, no types defined inside functions), many compilers put different information in them making them very unreliable so most debugger ignore these sections and parse the DWARF on their own. The tables must also be parsed and sorted in order to be used effectively. The new sections can be quickly loaded and very efficiently be used to do name to DIE lookups with very little up front work. The format of these new sections will be changing while we work out the bugs, but we hope to have really fast name to DIE lookups soon. llvm-svn: 138979
* Fixed an assertion that could happen if we happened to parse a mach-o objectGreg Clayton2011-08-261-1/+18
| | | | | | | | file that had a symbol that had a section specified where the section had zero size. We now honor this section definition for the symbol and don't assert anymore. llvm-svn: 138646
* Modified the LocateMacOSXFilesUsingDebugSymbols(...) function to locateGreg Clayton2011-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | an executable file if it is right next to a dSYM file that is found using DebugSymbols. The code also looks into a bundle if the dSYM file is right next to a bundle. Modified the MacOSX kernel dynamic loader plug-in to correctly set the load address for kext sections. This is a tad tricky because of how LLDB chooses to treat mach-o segments with no name. Also modified the loader to properly handle the older version 1 kext summary info. Fixed a crasher in the Mach-o object file parser when it is trying to set the section size correctly for dSYM sections. Added packet dumpers to the CommunicationKDP class. We now also properly detect address byte sizes based on the cpu type and subtype that is provided. Added a read memory and read register support to CommunicationKDP. Added a ThreadKDP class that now uses subclasses of the RegisterContextDarwin_XXX for arm, i386 and x86_64. Fixed some register numbering issues in the RegisterContextDarwin_arm class and added ARM GDB numbers to the ARM_GCC_Registers.h file. Change the RegisterContextMach_XXX classes over to subclassing their RegisterContextDarwin_XXX counterparts so we can share the mach register contexts between the user and kernel plug-ins. llvm-svn: 135466
* Fixed an assertion crasher. We now handle things correclty and Greg Clayton2011-07-101-3/+9
| | | | | | emit an error to stderr when we see this issue. llvm-svn: 134872
* Added the ability to get an abstract file type (executable, object file, Greg Clayton2011-07-092-0/+90
| | | | | | | | shared library, etc) and strata (user/kernel) from an object file. This will help with plug-in and platform selection when given a new binary with the "target create <file>" command. llvm-svn: 134779
* Fixed a crasher where we were accessing a symbol with a bad index.Greg Clayton2011-06-191-1/+1
| | | | llvm-svn: 133377
* ABI plug-ins must implement the following pure virtual functions:Greg Clayton2011-05-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual bool ABI::StackUsesFrames () = 0; Should return true if your ABI uses frames when doing stack backtraces. This means a frame pointer is used that points to the previous stack frame in some way or another. virtual bool ABI::CallFrameAddressIsValid (lldb::addr_t cfa) = 0; Should take a look at a call frame address (CFA) which is just the stack pointer value upon entry to a function. ABIs usually impose alignment restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed. This function should return true if "cfa" is valid call frame address for the ABI, and false otherwise. This is used by the generic stack frame unwinding code to help determine when a stack ends. virtual bool ABI::CodeAddressIsValid (lldb::addr_t pc) = 0; Validates a possible PC value and returns true if an opcode can be at "pc". Some ABIs or architectures have fixed width instructions and must be aligned to a 2 or 4 byte boundary. "pc" can be an opcode or a callable address which means the load address might be decorated with extra bits (such as bit zero to indicate a thumb function call for ARM targets), so take this into account when returning true or false. The address should also be validated to ensure it is a valid address for the address size of the inferior process. 32 bit targets should make sure the address is less than UINT32_MAX. Modified UnwindLLDB to use the new ABI functions to help it properly terminate stacks. Modified the mach-o function that extracts dependent files to not resolve the path as the paths inside a binary might not match those on the current host system. llvm-svn: 132021
* Fixed the LLDB build so that we can have private types, private enums andGreg Clayton2011-03-242-9/+9
| | | | | | | | public types and public enums. This was done to keep the SWIG stuff from parsing all sorts of enums and types that weren't needed, and allows us to abstract our API better. llvm-svn: 128239
* Added more platform support. There are now some new commands:Greg Clayton2011-03-192-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform status -- gets status information for the selected platform platform create <platform-name> -- creates a new instance of a remote platform platform list -- list all available platforms platform select -- select a platform instance as the current platform (not working yet) When using "platform create" it will create a remote platform and make it the selected platform. For instances for iPhone OS debugging on Mac OS X one can do: (lldb) platform create remote-ios --sdk-version=4.0 Remote platform: iOS platform SDK version: 4.0 SDK path: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0" Not connected to a remote device. (lldb) file ~/Documents/a.out Current executable set to '~/Documents/a.out' (armv6). (lldb) image list [ 0] /Volumes/work/gclayton/Documents/devb/attach/a.out [ 1] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/dyld [ 2] /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.B.dylib Note that this is all happening prior to running _or_ connecting to a remote platform. Once connected to a remote platform the OS version might change which means we will need to update our dependecies. Also once we run, we will need to match up the actualy binaries with the actualy UUID's to files in the SDK, or download and cache them locally. This is just the start of the remote platforms, but this modification is the first iteration in getting the platforms really doing something. llvm-svn: 127934
* LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provideGreg Clayton2011-03-082-31/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an interface to a local or remote debugging platform. By default each host OS that supports LLDB should be registering a "default" platform that will be used unless a new platform is selected. Platforms are responsible for things such as: - getting process information by name or by processs ID - finding platform files. This is useful for remote debugging where there is an SDK with files that might already or need to be cached for debug access. - getting a list of platform supported architectures in the exact order they should be selected. This helps the native x86 platform on MacOSX select the correct x86_64/i386 slice from universal binaries. - Connect to remote platforms for remote debugging - Resolving an executable including finding an executable inside platform specific bundles (macosx uses .app bundles that contain files) and also selecting the appropriate slice of universal files for a given platform. So by default there is always a local platform, but remote platforms can be connected to. I will soon be adding a new "platform" command that will support the following commands: (lldb) platform connect --name machine1 macosx connect://host:port Connected to "machine1" platform. (lldb) platform disconnect macosx This allows LLDB to be well setup to do remote debugging and also once connected process listing and finding for things like: (lldb) process attach --name x<TAB> The currently selected platform plug-in can now auto complete any available processes that start with "x". The responsibilities for the platform plug-in will soon grow and expand. llvm-svn: 127286
* Add a method "GetEntryPoint" to the ObjectFile class, and implement it on ↵Jim Ingham2011-03-072-2/+138
| | | | | | MachO & ELF - though the ELF implementation is probably a little weak. Then use this method in place of directly looking for "start" in the ThreadPlanCallFunction constructor to find the stopping point for our function evaluation. llvm-svn: 127194
* Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified formGreg Clayton2011-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of Stephen Wilson's idea (thanks for the input Stephen!). What I ended up doing was: - Got rid of ArchSpec::CPU (which was a generic CPU enumeration that mimics the contents of llvm::Triple::ArchType). We now rely upon the llvm::Triple to give us the machine type from llvm::Triple::ArchType. - There is a new ArchSpec::Core definition which further qualifies the CPU core we are dealing with into a single enumeration. If you need support for a new Core and want to debug it in LLDB, it must be added to this list. In the future we can allow for dynamic core registration, but for now it is hard coded. - The ArchSpec can now be initialized with a llvm::Triple or with a C string that represents the triple (it can just be an arch still like "i386"). - The ArchSpec can still initialize itself with a architecture type -- mach-o with cpu type and subtype, or ELF with e_machine + e_flags -- and this will then get translated into the internal llvm::Triple::ArchSpec + ArchSpec::Core. The mach-o cpu type and subtype can be accessed using the getter functions: uint32_t ArchSpec::GetMachOCPUType () const; uint32_t ArchSpec::GetMachOCPUSubType () const; But these functions are just converting out internal llvm::Triple::ArchSpec + ArchSpec::Core back into mach-o. Same goes for ELF. All code has been updated to deal with the changes. This should abstract us until later when the llvm::TargetSpec stuff gets finalized and we can then adopt it. llvm-svn: 126278
* Made lldb_private::ArchSpec contain much more than just an architecture. ItGreg Clayton2011-02-152-8/+4
| | | | | | | | | | now, in addition to cpu type/subtype and architecture flavor, contains: - byte order (big endian, little endian) - address size in bytes - llvm::Triple for true target triple support and for more powerful plug-in selection. llvm-svn: 125602
* Moved FileSpec into the Host layer since it will vary from host to host.Greg Clayton2011-02-082-2/+2
| | | | | | We have a common unix implementation in lldb/source/Host/common/FileSpec.cpp. llvm-svn: 125078
* Remove bzero use and replace with memset (patch from Kirk Beitz).Greg Clayton2011-02-041-3/+3
| | | | llvm-svn: 124897
* Applied a fix to qualify "UUID" with the lldb_private namespace to fixGreg Clayton2011-02-041-1/+1
| | | | | | build issues on MinGW. llvm-svn: 124888
* Endian patch from Kirk Beitz that allows better cross platform building.Greg Clayton2011-02-011-7/+7
| | | | llvm-svn: 124643
* Enabled extra warnings and fixed a bunch of small issues.Greg Clayton2011-01-251-2/+2
| | | | llvm-svn: 124250
* Fixed ProcessGDBRemote to kill the process correctly when it is either runningGreg Clayton2011-01-251-0/+8
| | | | | | | | or stopped. Added support for sections to be able to state if they are encrypted or not. llvm-svn: 124171
* 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
* Updated the lldb_private::Flags class to have better method names and madeGreg Clayton2010-10-271-1/+1
| | | | | | | | | | | | | | | | | all of the calls inlined in the header file for better performance. Fixed the summary for C string types (array of chars (with any combo if modifiers), and pointers to chars) work in all cases. Fixed an issue where a forward declaration to a clang type could cause itself to resolve itself more than once if, during the resolving of the type itself it caused something to try and resolve itself again. We now remove the clang type from the forward declaration map in the DWARF parser when we start to resolve it and avoid this additional call. This should stop any duplicate members from appearing and throwing all the alignment of structs, unions and classes. llvm-svn: 117437
* Fixed an issue where we were resolving paths when we should have been.Greg Clayton2010-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fixed a typo from my previous "Added support for LC_LOAD_UPWARD_DYLIB in ↵Greg Clayton2010-10-091-1/+1
| | | | | | mach-o files". llvm-svn: 116132
* Added support for LC_LOAD_UPWARD_DYLIB in mach-o files.Greg Clayton2010-10-091-0/+1
| | | | llvm-svn: 116128
* Added mutex protection to the Symtab class.Greg Clayton2010-10-081-1/+2
| | | | | | | | Added a new SortOrder enumeration and hooked it up to the "image dump symtab" command so we can dump symbol tables in the original order, sorted by address, or sorted by name. llvm-svn: 116049
* Hooked up ability to look up data symbols so they show up in disassemblyGreg Clayton2010-10-081-2/+10
| | | | | | | | | | | | if the address comes from a data section. Fixed an issue that could occur when looking up a symbol that has a zero byte size where no match would be returned even if there was an exact symbol match. Cleaned up the section dump output and added the section type into the output. llvm-svn: 116017
* Fixed an issue with the mach-o file parser when parsing indirect symbol stubsGreg Clayton2010-10-061-2/+6
| | | | | | | where the symbol index was set to INDIRECT_SYMBOL_ABS and was causing an assertion to fire when we loaded older Mac OS X binaries. llvm-svn: 115729
* Fixed an issue I found in the mach-o symbol table parsing whereGreg Clayton2010-09-121-21/+33
| | | | | | | | | | | | | | we cached remapping information using the old nlist index to the new symbol index, yet we tried to lookup the symbol stubs that were for symbols that had been remapped by ID instead of using the new symbol index. This is now fixed and the mach-o symbol tables are fixed. Use the delta between two vector entries to determine the stride in case any padding is inserted by compilers for bsearch calls on symbol tables when finding symbols by their original ID. llvm-svn: 113719
* Remove the eSymbolTypeFunction, eSymbolTypeGlobal, and eSymbolTypeStatic.Greg Clayton2010-09-111-54/+79
| | | | | | | | | | | | | | | | | | | They will now be represented as: eSymbolTypeFunction: eSymbolTypeCode with IsDebug() == true eSymbolTypeGlobal: eSymbolTypeData with IsDebug() == true and IsExternal() == true eSymbolTypeStatic: eSymbolTypeData with IsDebug() == true and IsExternal() == false This simplifies the logic when dealing with symbols and allows for symbols to be coalesced into a single symbol most of the time. Enabled the minimal symbol table for mach-o again after working out all the kinks. We now get nice concise symbol tables and debugging with DWARF in the .o files with a debug map in the binary works well again. There were issues where the SymbolFileDWARFDebugMap symbol file parser was using symbol IDs and symbol indexes interchangeably. Now that all those issues are resolved debugging is working nicely. llvm-svn: 113678
* Always look up the symbols with FindSymbolByID since we are minimizing the ↵Jim Ingham2010-09-101-9/+1
| | | | | | symbol list. llvm-svn: 113655
* Disable minimized symbol tables for now as this was causing test suite failures.Greg Clayton2010-09-081-1/+1
| | | | llvm-svn: 113372
* Enable minimized symbol tables when parsing mach-o files. ThisGreg Clayton2010-09-081-4/+55
| | | | | | | | | | new change will omit unneeded symbol table entries and coalesce function entries (N_FUN stab entries) with their linker code symbol (N_SECT symbols) into only the function symbol to avoid duplicate symbol table entries. It will also coalesce N_STSYM and the data linker symbol into just one static data symbol. llvm-svn: 113363
* Added Symtab::FindSymbolByID() in preparation for enabling the minimalGreg Clayton2010-09-071-1/+11
| | | | | | | | | symbol tables. Minimal symbol tables enable us to merge two symbols, one debug symbol and one linker symbol, into a single symbol that can carry just as much information and will avoid duplicate symbols in the symbol table. llvm-svn: 113223
* Change Target & Process so they can really be initialized with an invalid ↵Jim Ingham2010-08-092-1/+10
| | | | | | | | | | | | 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
* Modified both the ObjectFileMachO and ObjectFileELF to correctly set theGreg Clayton2010-07-211-9/+42
| | | | | | | | | | | | | 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-212-120/+138
| | | | | | | | | | | 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
* Merged Eli Friedman's linux build changes where he added Makefile files thatGreg Clayton2010-07-091-0/+14
| | | | | | | 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-061-3/+3
| | | | llvm-svn: 107716
* Fixed debug map in executable + DWARF in .o debugging on Mac OS X.Greg Clayton2010-06-281-0/+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
* Made lldb_private::ArchSpec more generic so that it can take a mach-o cpuGreg Clayton2010-06-111-2/+2
| | | | | | | | | | | | | | | | type and sub-type, or an ELF e_machine value. Also added a generic CPU type to the arch spec class so we can have a single arch definition that the LLDB core code can use. Previously a lot of places in the code were using the mach-o definitions from a macosx header file. Switches over to using "llvm/Support/MachO.h" for the llvm::MachO::XXX for the CPU types and sub types for mach-o ArchSpecs. Added "llvm/Support/ELF.h" so we can use the "llvm::ELF::XXX" defines for the ELF ArchSpecs. Got rid of all CPU_TYPE_ and CPU_SUBTYPE_ defines that were previously being used in LLDB. llvm-svn: 105806
* Initial checkin of lldb code from internal Apple repo.Chris Lattner2010-06-082-0/+1442
llvm-svn: 105619
OpenPOWER on IntegriCloud