summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow ObjectFilePECOFF to initialize with ARM binaries.Stephane Sezer2017-10-241-0/+5
| | | | | | | | | | | | | | Summary: This is required to start debugging WinPhone ARM targets. Reviewers: compnerd, zturner, omjavaid Reviewed By: compnerd Subscribers: jasonmolenda, aemerson, rengolin, lldb-commits Differential Revision: https://reviews.llvm.org/D19604 llvm-svn: 316532
* silence a couple of -Wqual-cast warning from GCC (NFC)Saleem Abdulrasool2017-07-191-1/+2
| | | | | | | | | | | | | | | Cast to `const uint8_t *` instead of `uint8_t *` to avoid the warning from GCC. EmulationStateARM.cpp:206:34: warning: cast from type 'const void*' to type 'uint8_t* {aka unsigned char*}' casts away qualifiers [-Wcast-qual] Cast to `const uint32_t *` and the explicitly cast away the const-ness of the value. This seems pretty sketchy as the `DataExtractor` holds a const reference to the data. However, this is no worse than before. ObjectFilePECOFF.cpp:540:78: warning: cast from type 'const uint8_t* {aka const unsigned char*}' to type 'uint32_t* {aka unsigned int*}' casts away qualifiers [-Wcast-qual] llvm-svn: 308489
* Move Timer and TraceOptions from Core to UtilityPavel Labath2017-06-291-1/+1
| | | | | | | | | | | | | | Summary: The classes have no dependencies, and they are used both by lldb and lldb-server, so it makes sense for them to live in the lowest layers. Reviewers: zturner, jingham Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34746 llvm-svn: 306682
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-1/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Rename Error -> Status.Zachary Turner2017-05-121-2/+2
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-221-1/+1
| | | | llvm-svn: 298536
* Remove FileSpec::ReadFileContents.Zachary Turner2017-03-061-3/+6
| | | | | | | | | | | | | | | | This functionality is subsumed by DataBufferLLVM, which is also more efficient since it will try to mmap. However, we don't yet support mmaping writable private sections, and in some cases we were using ReadFileContents and then modifying the buffer. To address that I've added a flag to the DataBufferLLVM methods that allow you to map privately, which disables the mmaping path entirely. Eventually we should teach DataBufferLLVM to use mmap with writable private, but that is orthogonal to this effort. Differential Revision: https://reviews.llvm.org/D30622 llvm-svn: 297095
* Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner2017-03-041-5/+7
| | | | llvm-svn: 296943
* Move UUID from Core -> Utility.Zachary Turner2017-03-041-1/+1
| | | | llvm-svn: 296941
* Delete DataBufferMemoryMap.Zachary Turner2017-02-241-11/+21
| | | | | | | | | | | | | | | After a series of patches on the LLVM side to get the mmaping code up to compatibility with LLDB's needs, it is now ready to go, which means LLDB's custom mmapping code is redundant. So this patch deletes it all and uses LLVM's code instead. In the future, we could take this one step further and delete even the lldb DataBuffer base class and rely entirely on LLVM's facilities, but this is a job for another day. Differential Revision: https://reviews.llvm.org/D30054 llvm-svn: 296159
* Move classes from Core -> Utility.Zachary Turner2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* [lldb] Read modules from memory when a local copy is not availableWalter Erquinigo2016-10-171-69/+107
| | | | | | | | | | | | | | | | | | | Summary: When the local lldb doesn't have access to a copy of the modules in the target, e.g. winphone, with this change now we read these modules from memory. There are mainly 2 changes: 1. create pecoff object files from memory 2. read from memory when the local file is not available Reviewers: sas, fjricci, zturner Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D24284 llvm-svn: 284422
* [PECOFF] Use the COFF subsystem field when determining the Triple.Zachary Turner2016-09-201-1/+18
| | | | | | | Patch by walter erquinigo Differential revision: https://reviews.llvm.org/D24284 llvm-svn: 282013
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-912/+803
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* second pass over removal of Mutex and ConditionSaleem Abdulrasool2016-05-191-2/+2
| | | | llvm-svn: 270024
* remove use of Mutex in favour of std::{,recursive_}mutexSaleem Abdulrasool2016-05-181-4/+4
| | | | | | | | | | This is a pretty straightforward first pass over removing a number of uses of Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there are interfaces which take Mutex::Locker & to lock internal locks. This patch cleans up most of the easy cases. The only non-trivial change is in CommandObjectTarget.cpp where a Mutex::Locker was split into two. llvm-svn: 269877
* Implement ObjectFilePECOFF::GetEntryPointAddress.Stephane Sezer2016-03-231-1/+21
| | | | | | | | | | Reviewers: zturner, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D17970 llvm-svn: 264173
* Set symbol types for function symbols loaded from PE/COFFAdrian McCarthy2016-01-261-4/+17
| | | | | | | | | | | | | | | | This fixes the regression of several tests on Windows after rL258621. The root problem is that ObjectFilePECOFF was not setting type information for the symbols, and the new CL rejects symbols without type information, breaking functionality like thread step-over. The fix sets the type information for functions (and creates a TODO for other types). Along the way, I fixed some typos and formatting that made the code I was debugging harder to understand. In the long run, we should consider replacing most of ObjectFilePECOFF with the COFF parsing code from LLVM. Differential Revision: http://reviews.llvm.org/D16563 llvm-svn: 258758
* Add CalculateSymbolSizes in ObjectFilePECOFF::GetSymtab to ensure that ↵Adrian McCarthy2016-01-211-0/+1
| | | | | | | | | | (nearly) all the symbols have sizes. This fixes the `thread step-over` regression exposed by http://reviews.llvm.org/D16186 , which depends on the symbols having actual sizes. Nine tests on Windows had started failing as a result. They all work again with this fix. Differential Revision: http://reviews.llvm.org/D16415 llvm-svn: 258429
* Enable saving of mini dumps with lldb process save-core.Adrian McCarthy2015-11-201-1/+12
| | | | | | | | Also adds SB API to save a core and tests that use it. Differential Revision: http://reviews.llvm.org/D14793 llvm-svn: 253734
* Revert "FOO"Adrian McCarthy2015-11-201-12/+1
| | | | | | | | Accidentally commited before I was done. This reverts commit 2ec2da4ee52780582d5e9c88b2e982a688fbdbe1. llvm-svn: 253685
* FOOAdrian McCarthy2015-11-201-1/+12
| | | | llvm-svn: 253684
* Add an OperatingSystem plugin to support goroutinesRyan Brown2015-09-161-0/+2
| | | | | | | | | | The Go runtime schedules user level threads (goroutines) across real threads. This adds an OS plugin to create memory threads for goroutines. It supports the 1.4 and 1.5 go runtime. Differential Revision: http://reviews.llvm.org/D5871 llvm-svn: 247852
* Resubmitting 240466 after fixing the linux test suite failures.Greg Clayton2015-06-251-2/+2
| | | | | | | | | | | | | | | A few extras were fixed - Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. - Since some places want to access the address as a reference, I added a few new functions to symbol: Address &Symbol::GetAddressRef(); const Address &Symbol::GetAddressRef() const; Linux test suite passes just fine now. <rdar://problem/21494354> llvm-svn: 240702
* Avoid crashing by not mmap'ing files on network mounted file systems.Greg Clayton2015-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | This is implemented by making a new FileSystem function: bool FileSystem::IsLocal(const FileSpec &spec) Then using this in a new function: DataBufferSP FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const; This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB. We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function. <rdar://problem/19470249> llvm-svn: 230283
* Don't stomp the triple when loading a PECOFF target.Zachary Turner2015-01-221-1/+8
| | | | | | | | | | | | | | | | | | | | | When you create a target, it tries to look for the platform's list of supported architectures for a match. The match it finds can contain specific triples, like i386-pc-windows-msvc. Later, we overwrite this value with the most generic triple that can apply to any platform with COFF support, causing some of the fields of the triple to get overwritten. This patch changes the behavior to only merge in values from the COFF triple if the fields of the matching triple were unknown/unspecified to begin with. This fixes load address resolution on Windows, since it enables the DynamicLoaderWindows to be used instead of DynamicLoaderStatic. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D7120 llvm-svn: 226849
* Remove unused variable that was causing a warning.Greg Clayton2014-07-291-1/+0
| | | | llvm-svn: 214230
* Fix supported architectures on PlatformWindows.Zachary Turner2014-07-281-1/+5
| | | | | | | | | | i386, i486, i486sx, and i686 are all indistinguishable as far as PE/COFF files are concerned. This patch adds support for all of these architectures to PlatformWindows. Differential Revision: http://reviews.llvm.org/D4658 llvm-svn: 214092
* Fix typos.Bruce Mitchener2014-07-081-1/+1
| | | | llvm-svn: 212553
* Patch from Keno Fischer to enable JITLoaderGDB with mach-o file support.Greg Clayton2014-06-241-0/+1
| | | | | | The patch is as is with the functionality left disabled for apple vendors because of performance regressions. If this is enabled it ends up searching for symbols in all shared libraries that are loadeded. llvm-svn: 211638
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-5/+5
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Cleanup some dead assignements reported by scan-buildArnaud A. de Grandmaison2014-03-221-1/+0
| | | | | | No functionnal change. llvm-svn: 204545
* update for renaming in LLVMSaleem Abdulrasool2014-03-111-1/+1
| | | | llvm-svn: 203533
* Implement ObjectFilePECOFF::GetModuleSpecifications().Virgile Bello2014-03-091-48/+74
| | | | llvm-svn: 203383
* Implement ObjectFilePECOFF::SetLoadAddress().Virgile Bello2014-03-081-0/+42
| | | | llvm-svn: 203350
* Remove %zx in printf (only GCC supports it, not MSVC).Virgile Bello2014-03-081-1/+1
| | | | llvm-svn: 203349
* Fix for PECOFF GetArchitectureColin Riley2013-11-221-1/+1
| | | | | | 0 as CPU subtype never matches anything (at least, it doesn't match x86_64 windows binaries, of which there are correct arch definitions for). It should be created with LLDB_INVALID_CPUTYPE. llvm-svn: 195435
* Plugins/ObjectFile/PECOFF: Use enums from LLVM, and don't use Mach-O ↵Charles Davis2013-08-271-124/+22
| | | | | | | | | | definitions. Since I renamed most of the LLVM Mach-O enums in r189314, I had to go fix LLDB to use the new names. While I was here, I decided that a COFF plugin really shouldn't be using Mach-O enums. llvm-svn: 189316
* PECOFF: Add support for export table.Virgile Bello2013-08-251-0/+53
| | | | llvm-svn: 189192
* Cleanup on the unified section list changes. Main changes are:Greg Clayton2013-07-101-14/+23
| | | | | | | | | | | | | | | - ObjectFile::GetSymtab() and ObjectFile::ClearSymtab() no longer takes any flags - Module coordinates with the object files and contain a unified section list so that object file and symbol file can share sections when they need to, yet contain their own sections. Other cleanups: - Fixed Symbol::GetByteSize() to not have the symbol table compute the byte sizes on the fly - Modified the ObjectFileMachO class to compute symbol sizes all at once efficiently - Modified the Symtab class to store a file address lookup table for more efficient lookups - Removed Section::Finalize() and SectionList::Finalize() as they did nothing - Improved performance of the detection of symbol files that have debug maps by excluding stripped files and core files, debug files, object files and stubs - Added the ability to tell if an ObjectFile has been stripped with ObjectFile::IsStripped() (used this for the above performance improvement) llvm-svn: 185990
* Split symbol support for ELF and Linux.Michael Sartain2013-07-011-2/+3
| | | | llvm-svn: 185366
* A collection of 3 patches to the COFF file ObjectFile parser from Virgile Bello:Greg Clayton2013-06-181-5/+40
| | | | | | | | | 3 patches, aiming to improve PE/COFF support: - First patch fix symbol reading (invalid header size from sizeof() == 20 != 18, and various bugfixes such as invalid skipping of auxiliary symbols, 4 bytes shift from beginning, etc...). - Second patch add image_base to section vmaddr offset so that VM addr is in image_base space. - Third patch add support for DWARF section in PECOFF (taken from ELF counterpart), since they are generated by gcc/clang under windows. llvm-svn: 184153
* <rdar://problem/13854277>Greg Clayton2013-05-101-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* Added the ability to extract a ModuleSpecList (a new class) from an ↵Greg Clayton2013-04-241-1/+15
| | | | | | | | | | | | | | | | | ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)). There is a new static ObjectFile function you can call: size_t ObjectFile::GetModuleSpecifications (const FileSpec &file, lldb::offset_t file_offset, ModuleSpecList &specs) This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question). This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info. llvm-svn: 180224
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* <rdar://problem/13159777> Greg Clayton2013-02-061-10/+25
| | | | | | | | | | | | | | lldb was mmap'ing archive files once per .o file it loads, now it correctly shares the archive between modules. LLDB was also always mapping entire contents of universal mach-o files, now it maps just the slice that is required. Added a new logging channel for "lldb" called "mmap" to help track future regressions. Modified the ObjectFile and ObjectContainer plugin interfaces to take a data offset along with the file offset and size so we can implement the correct caching and efficient reading of parts of files without mmap'ing the entire file like we used to. The current implementation still keeps entire .a files mmaped (once) and entire slices from universal files mmaped to ensure that if a client builds their binaries during a debug session we don't lose our data and get corrupt object file info and debug info. llvm-svn: 174524
* <rdar://problem/13069948>Greg Clayton2013-01-251-11/+11
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-5/+5
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Changed the V1 and V2 runtimes to be able to detect when the ISA hash table ↵Greg Clayton2012-10-251-2/+0
| | | | | | has changed, and auto update as needed. llvm-svn: 166693
OpenPOWER on IntegriCloud