summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler
Commit message (Collapse)AuthorAgeFilesLines
...
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-3/+7
| | | | llvm-svn: 165808
* A patch that allows for mach-o architectures to be specified as ↵Greg Clayton2012-09-191-4/+6
| | | | | | "<number>-<number>" where the first number is the cpu type and the second is the cpu subtype. Also added code to allow use of mach-o architectures that aren't in our tables so that symbolication and static file introspection (crashlogs) can work with them. llvm-svn: 164258
* <rdar://problem/11757916>Greg Clayton2012-08-291-0/+1
| | | | | | | | | | | | Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
* Changed the Opcode::GetData() API so that it didn'tSean Callanan2012-08-071-1/+1
| | | | | | | | require an AddressClass, which is useless at this point since it already knows the distinction between 32-bit Thumb opcodes and 32-bit ARM opcodes. llvm-svn: 161382
* Fixed an error in the thumb opcode encoding. We need the 32 bit thumb ↵Greg Clayton2012-08-071-3/+4
| | | | | | instructions to be encoded as a 32 bit value for the EmulateARM code. llvm-svn: 161381
* Improved raw disassembly output for Thumb.Sean Callanan2012-08-061-4/+5
| | | | llvm-svn: 161360
* Instructions generated by a disassembler can nowSean Callanan2012-08-011-0/+2
| | | | | | | | | | | | | | | | | | keep a shared pointer to their disassembler. This is important for the LLVM-C disassembler because it needs to lock its parent in order to disassemble itself. This means that every interface that returned a Disassembler* needs to return a DisassemblerSP, so that the instructions and any external owners share the same reference count on the object. I changed all clients to use this shared pointer, which also plugged a few leaks. <rdar://problem/12002822> llvm-svn: 161123
* <rdar://problem/11330621>Greg Clayton2012-05-104-635/+324
| | | | | | | | | | | | Fixed the DisassemblerLLVMC disassembler to parse more efficiently instead of parsing opcodes over and over. The InstructionLLVMC class now only reads the opcode in the InstructionLLVMC::Decode function. This can be done very efficiently for ARM and architectures that have fixed opcode sizes. For x64 it still calls the disassembler to get the byte size. Moved the lldb_private::Instruction::Dump(...) function up into the lldb_private::Instruction class and it now uses the function that gets the mnemonic, operandes and comments so that all disassembly is using the same code. Added StreamString::FillLastLineToColumn() to allow filling a line up to a column with a character (which is used by the lldb_private::Instruction::Dump(...) function). Modified the Opcode::GetData() fucntion to "do the right thing" for thumb instructions. llvm-svn: 156532
* <rdar://problem/11358639>Greg Clayton2012-05-081-1/+4
| | | | | | | | Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples. Also make the selection process for auto selecting platforms based off of an arch much better. llvm-svn: 156354
* Expose GetAddressClass() from both the SBAddress and SBInstruction so ↵Greg Clayton2012-04-132-3/+3
| | | | | | clients can tell the difference between ARM/Thumb opcodes when disassembling ARM. llvm-svn: 154633
* Cleaned up code that was getting SBData for an SBInstruction.Greg Clayton2012-04-111-22/+37
| | | | llvm-svn: 154535
* Improved detection of ARM branch instructions toSean Callanan2012-04-101-6/+4
| | | | | | cover all possible condition codes. llvm-svn: 154440
* Fixed a leak in the LLVM disassembler where weSean Callanan2012-04-061-0/+10
| | | | | | | did not destroy the underlying disassembler in our destructor. llvm-svn: 154185
* Order ivar initializers to how they're declared in the class.Bill Wendling2012-04-061-1/+1
| | | | llvm-svn: 154146
* Resolved two problems in the disassembler:Sean Callanan2012-03-221-5/+7
| | | | | | | | | | | - Addresses with no description were given comments, leading to useless comments like "; , " - Addresses weren't resolved with respect to the correct module. llvm-svn: 153274
* Fixed a bug in the disassembler where we didSean Callanan2012-03-221-29/+38
| | | | | | | not properly print the load addresses for PC-relative jumps. llvm-svn: 153233
* Since we are having issues with the new LLVM MC disassembler, we can haveGreg Clayton2012-03-222-4/+4
| | | | | | | | | | | | | | | | | them both installed with the LLVM MC version being the default. I renamed the name of the LLVM MC disassembler plug-in to "llvm-mc" and the LLVM enhanced disassembly plug-in to "llvm-edis" and they can both be installed for now. To use the "llvm-edis" disassembler, you can just specify it while disassembling: (lldb) disassemble --plugin llvm-edis --name main (lldb) disassemble --plugin llvm-mc --name main This will allow us to compare the output of the two disassembler and eventually deprecate the old one when the new one is ready. But it does use the new disassembler by default so we continue to test it on a daily basis. llvm-svn: 153231
* Added a function to the disassembler that checksSean Callanan2012-03-021-2/+92
| | | | | | | | (from the mnemonic) whether an instruction is a branch. This function's result is exposed through DoesBranch(). llvm-svn: 151953
* <rdar://problem/10103468>Greg Clayton2012-02-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | I started work on being able to add symbol files after a debug session had started with a new "target symfile add" command and quickly ran into problems with stale Address objects in breakpoint locations that had lldb_private::Section pointers into modules that had been removed or replaced. This also let to grabbing stale modules from those sections. So I needed to thread harded the Address, Section and related objects. To do this I modified the ModuleChild class to now require a ModuleSP on initialization so that a weak reference can created. I also changed all places that were handing out "Section *" to have them hand out SectionSP. All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild so all of the find plug-in, static creation function and constructors now require ModuleSP references instead of Module *. Address objects now have weak references to their sections which can safely go stale when a module gets destructed. This checkin doesn't complete the "target symfile add" command, but it does get us a lot clioser to being able to do such things without a high risk of crashing or memory corruption. llvm-svn: 151336
* Updated LLVM to take some fixes that make theSean Callanan2012-02-231-19/+7
| | | | | | | | | | | Intel disassembler usable. Also flipped the switch: we are now exclusively using Disassembler.h instead of EnhancedDisassembly.h for all disassembly in LLDB. llvm-svn: 151306
* Fix compile error for DisassemblerLLVMC.cpp.Johnny Chen2012-02-201-1/+2
| | | | | | | | Patch by Dmitry Vyukov <dvyukov@google.com>. Also add the relevant files to the Xcode project. llvm-svn: 150991
* The second part in thread hardening the internals of LLDB where we makeGreg Clayton2012-02-181-16/+21
| | | | | | | | | | | | | | | | the lldb_private::StackFrame objects hold onto a weak pointer to the thread object. The lldb_private::StackFrame objects the the most volatile objects we have as when we are doing single stepping, frames can often get lost or thrown away, only to be re-created as another object that still refers to the same frame. We have another bug tracking that. But we need to be able to have frames no longer be able to get the thread when they are not part of a thread anymore, and this is the first step (this fix makes that possible but doesn't implement it yet). Also changed lldb_private::ExecutionContextScope to return shared pointers to all objects in the execution context to further thread harden the internals. llvm-svn: 150871
* Added a new disassembler plugin, DisassemblerLLVMC,Sean Callanan2012-02-172-0/+706
| | | | | | | | | | | | | | | | | | | which uses the Disassembler.h interface to the LLVM disassemblers rather than the EnhancedDisassembly.h interface. Disassembler.h is a better-maintained API and will be stabler in the long term. Currently the output from Disassembler.h does not provide for symbolic disassembly in all the places that the old disassembler did, so I have gated (and disabled) the disassembler. It'll be easy to flip the switch later. In the meantime, to enable the new disassembler, uncomment "#define USE_NEW_DISASSEMBLER" in lldb.cpp. llvm-svn: 150772
* Switching back to using std::tr1::shared_ptr. We originally switched awayGreg Clayton2012-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell. Once the RTTI issue wasn't an issue, we were looking for a way to properly track weak pointers to objects to solve some of the threading issues we have been running into which naturally led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared pointer from just a pointer, which is also easily solved using the std::tr1::enable_shared_from_this class. The main reason for this move back is so we can start properly having weak references to objects. Currently a lldb_private::Thread class has a refrence to its parent lldb_private::Process. This doesn't work well when we now hand out a SBThread object that contains a shared pointer to a lldb_private::Thread as this SBThread can be held onto by external clients and if they end up using one of these objects we can easily crash. So the next task is to start adopting std::tr1::weak_ptr where ever it makes sense which we can do with lldb_private::Debugger, lldb_private::Target, lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and many more objects now that they are no longer using intrusive ref counted pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive pointers). llvm-svn: 149207
* Fixed an issue with the Instruction subclasses where the strings mightGreg Clayton2012-01-192-22/+2
| | | | | | | | | | be fetched too many times and the DisassemblerLLVM was appending to strings when the opcode, mnemonic and comment accessors were called multiple times and if any of the strings were empty. Also fixed the test suite failures from recent Objective C modifications. llvm-svn: 148460
* Handle all of the "thumb" target triple architecture variants that llvmGreg Clayton2011-12-161-1/+1
| | | | | | handles. llvm-svn: 146746
* Patch from Daniel Dunbar for future-proof against ↵Johnny Chen2011-11-291-0/+11
| | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=145331. llvm-svn: 145345
* warnings: Fix a bunch of -Wreorder problems.Daniel Dunbar2011-10-311-2/+2
| | | | llvm-svn: 143381
* Fixed a leak in the LLVM disassembler where theSean Callanan2011-10-271-1/+7
| | | | | | | | InstructionLLVM class dropped its instruction handle on the floor instead of releasing it correctly. llvm-svn: 143156
* Fixed the public and internal disassembler API to be named correctly:Greg Clayton2011-09-272-8/+8
| | | | | | | | | | | | | | | const char * SBInstruction::GetMnemonic() const char * SBInstruction::GetOperands() const char * SBInstruction::GetComment() Fixed the symbolicate example script and the internals. llvm-svn: 140591
* Added more functionality to the public API to allow for betterGreg Clayton2011-09-262-14/+167
| | | | | | | | | | | | | | | | | | symbolication. Also improved the SBInstruction API to allow access to the instruction opcode name, mnemonics, comment and instruction data. Added the ability to edit SBLineEntry objects (change the file, line and column), and also allow SBSymbolContext objects to be modified (set module, comp unit, function, block, line entry or symbol). The SymbolContext and SBSymbolContext can now generate inlined call stack infomration for symbolication much easier using the SymbolContext::GetParentInlinedFrameInfo(...) and SBSymbolContext::GetParentInlinedFrameInfo(...) methods. llvm-svn: 140518
* Converted the lldb_private::Process over to use the intrusiveGreg Clayton2011-09-221-4/+10
| | | | | | | | | | | | | | | | | | | | shared pointers. Changed the ExecutionContext over to use shared pointers for the target, process, thread and frame since these objects can easily go away at any time and any object that was holding onto an ExecutionContext was running the risk of using a bad object. Now that the shared pointers for target, process, thread and frame are just a single pointer (they all use the instrusive shared pointers) the execution context is much safer and still the same size. Made the shared pointers in the the ExecutionContext class protected and made accessors for all of the various ways to get at the pointers, references, and shared pointers. llvm-svn: 140298
* Revert the workaround patch in the last check in. With the local patch to ↵Johnny Chen2011-08-191-30/+1
| | | | | | LLVM, it is no longer necessary. llvm-svn: 138046
* Apply some workaround for known crashers.Johnny Chen2011-08-181-1/+30
| | | | llvm-svn: 137991
* Fixed an issue of wrong (by +2) branch target calculation in the ↵Johnny Chen2011-08-031-0/+6
| | | | | | | | | | | disassembler's symbolic information output. A8.6.23 BLX (immediate T2) Target Address = Align(PC, 4) + offset value rdar://problem/9885678 llvm-svn: 136766
* The implementation of categories is now synchronization safeEnrico Granata2011-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Code cleanup: - The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...) are contained. The wrapper code always remains in Debugger.{h|cpp} - Several leftover fields, methods and comments from previous design choices have been removed type category subcommands (enable, disable, delete) now can take a list of category names as input - for type category enable, saying "enable A B C" is the same as saying enable C enable B enable A (the ordering is relevant in enabling categories, and it is expected that a user typing enable A B C wants to look into category A, then into B, then into C and not the other way round) - for the other two commands, the order is not really relevant (however, the same inverted ordering is used for consistency) llvm-svn: 135494
* Add comment.Johnny Chen2011-05-241-0/+2
| | | | llvm-svn: 131998
* Refactor InstructionLLVM::Dump() a little bit to reduce the entropy by ↵Johnny Chen2011-05-231-45/+35
| | | | | | | | | introducing a new file static utility function AddSymbolicInfo() which is called from places within InstructionLLVM::Dump(). llvm-svn: 131937
* Add more workarounds for "bl #..." and "blx #..." where the ARMAsmParser ↵Johnny Chen2011-05-231-0/+28
| | | | | | | | fails to parse/recognize the (PC-relative) immediate operand. llvm-svn: 131913
* Fix the Align() utility which tries to align the raw disassembly with the ↵Johnny Chen2011-05-231-4/+10
| | | | | | | | | | | edis'ed disassembly so that both the opcode and the operands are aligned with the rest of output. Comment out the code related to force_raw mode when disassembling arm or thumb for now. It testing goes ok, we will remove the section of code related to force_raw. llvm-svn: 131910
* A little refactoring.Johnny Chen2011-05-211-7/+10
| | | | llvm-svn: 131779
* When in non-raw mode and edis fails to parse the tokens of the instruction, ↵Johnny Chen2011-05-211-1/+10
| | | | | | | | output the raw disassembly so that the opcode aligns with the edis'ed disassembly. llvm-svn: 131773
* Fix build error - strstr returns a const char *Peter Collingbourne2011-05-201-1/+1
| | | | llvm-svn: 131766
* Workaround the issue of llvm:tB (A8.6.16 B Encoding T2) not being processed asJohnny Chen2011-05-201-0/+24
| | | | | | | | | | a branch instruction and therefore the symbolic information is not being dumped for non-raw mode. The problem is that the ARMAsmParser is not recognizing the "#274" in "b #274" as a valid operand when doing disassembly in non-raw mode. llvm-svn: 131738
* Make InstructionLLVM::Dump() more robust for edis in cases when all theJohnny Chen2011-05-191-24/+36
| | | | | | | | | | | | EDOperandIndexForToken(token) calls fail to return a meaningful operand index, resulting in both operands and comment being empty. We will use the raw disassembly string as output in these cases. There is still a known bug where llvm:tB (A8.6.16 B Encoding T2) is not being processed as a branch instruction and therefore the symbolic information is not being dumped for non-raw mode. llvm-svn: 131615
* Some refactorings with respect to setting of the 'printTokenized' flag.Johnny Chen2011-05-181-20/+16
| | | | | | Add some comments. llvm-svn: 131594
* Remove dead code which tests for boolan flag 'raw' and restore one ↵Johnny Chen2011-05-181-47/+39
| | | | | | indentation level. llvm-svn: 131589
* If the use_thumb is set, pass llvm::Triple::thumb to the ↵Johnny Chen2011-05-181-1/+1
| | | | | | | | | | InstructionLLVM.ctor() unconditionally. Otherwise, pass m_arch.GetMachine(). Followup patch for rdar://problem/9170971. llvm-svn: 131549
* Fix the InstructionLLVM::Dump() so that for Triple::arm, PC reads as the addressJohnny Chen2011-05-122-17/+22
| | | | | | | | | of the current instruction plus 8. And for Triple::thumb, it is plus 4. rdar://problem/9170971 lldb disassembly's symbol information not correct (off by 2?) llvm-svn: 131256
* Construction of the RegisterReaderArg instance should happen after we have a ↵Johnny Chen2011-05-121-2/+2
| | | | | | valid base_addr, not before. llvm-svn: 131236
OpenPOWER on IntegriCloud