summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Instruction/ARM
Commit message (Collapse)AuthorAgeFilesLines
...
* While implementing unwind information using UnwindAssemblyInstEmulation I ranGreg Clayton2011-05-093-195/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into some cleanup I have been wanting to do when reading/writing registers. Previously all RegisterContext subclasses would need to implement: virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data); virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0); There is now a new class specifically designed to hold register values: lldb_private::RegisterValue The new register context calls that subclasses must implement are: virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0; virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0; The RegisterValue class must be big enough to handle any register value. The class contains an enumeration for the value type, and then a union for the data value. Any integer/float values are stored directly in an appropriate host integer/float. Anything bigger is stored in a byte buffer that has a length and byte order. The RegisterValue class also knows how to copy register value bytes into in a buffer with a specified byte order which can be used to write the register value down into memory, and this does the right thing when not all bytes from the register values are needed (getting a uint8 from a uint32 register value..). All RegiterContext and other sources have been switched over to using the new regiter value class. llvm-svn: 131096
* Added the start of the CFI row production using theGreg Clayton2011-04-291-1/+1
| | | | | | emulate instruction classes. llvm-svn: 130556
* Added a new OptionValue subclass for lldb::Format: OptionValueFormat. AddedGreg Clayton2011-04-272-5/+5
| | | | | | | | | | | | | | | | | | | | | new OptionGroup subclasses for: - output file for use with options: long opts: --outfile <path> --append--output short opts: -o <path> -A - format for use with options: long opts: --format <format> - variable object display controls for depth, pointer depth, wether to show types, show summary, show location, flat output, use objc "po" style summary. Modified ValueObjectMemory to be able to be created either with a TypeSP or a ClangASTType. Switched "memory read" over to use OptionGroup subclasses: one for the outfile options, one for the command specific options, and one for the format. llvm-svn: 130334
* Got the EmulateInstruction CFI code a lot closer to producing CFI data.Greg Clayton2011-04-264-334/+347
| | | | | | | | | | | | | Switch the EmulateInstruction to use the standard RegisterInfo structure that is defined in the lldb private types intead of passing the reg kind and reg num everywhere. EmulateInstruction subclasses also need to provide RegisterInfo structs given a reg kind and reg num. This eliminates the need for the GetRegisterName() virtual function and allows more complete information to be passed around in the read/write register callbacks. Subclasses should always provide RegiterInfo structs with the generic register info filled in as well as at least one kind of register number in the RegisterInfo.kinds[] array. llvm-svn: 130256
* Modify EmulateInstructionARM::SetArchitecture() to treat "arm" and "thumb" ↵Johnny Chen2011-04-261-0/+2
| | | | | | | | | as wild card architectures for now, in order to fix the test failure for the 'arm_emulation' directory. There might be a better way. llvm-svn: 130227
* Changed the emulate instruction function to take emulate options whichGreg Clayton2011-04-264-204/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are defined as enumerations. Current bits include: eEmulateInstructionOptionAutoAdvancePC eEmulateInstructionOptionIgnoreConditions Modified the EmulateInstruction class to have a few more pure virtuals that can help clients understand how many instructions the emulator can handle: virtual bool SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0; Where instruction types are defined as: //------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { eInstructionTypeAny, // Support for any instructions at all (at least one) eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer eInstructionTypeAll // All instructions of any kind } InstructionType; This allows use to tell what an emulator can do and also allows us to request these abilities when we are finding the plug-in interface. Added the ability for an EmulateInstruction class to get the register names for any registers that are part of the emulation. This helps with being able to dump and log effectively. The UnwindAssembly class now stores the architecture it was created with in case it is needed later in the unwinding process. Added a function that can tell us DWARF register names for ARM that goes along with the source/Utility/ARM_DWARF_Registers.h file: source/Utility/ARM_DWARF_Registers.c Took some of plug-ins out of the lldb_private namespace. llvm-svn: 130189
* Change code for reading emulation data files to read the new fileCaroline Tice2011-04-224-128/+131
| | | | | | | format. (The newly formatted files will go in as a separate commit in a few minutes). llvm-svn: 129981
* Add the infrastructure to test instruction emulations automatically.Caroline Tice2011-04-194-10/+651
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea is that the instruction to be emulated is actually executed on the hardware to be emulated, with the before and after state of the hardware being captured and 'freeze-dried' into .dat files. The emulation testing code then loads the before & after state from the .dat file, emulates the instruction using the before state, and compares the resulting state to the 'after' state. If they match, the emulation is accurate, otherwise there is a problem. The final format of the .dat files needs a bit more work; the plan is to generalize them a bit and to convert the plain values to key-value pairs. But I wanted to get this first pass committed. This commit adds arm instruction emulation testing to the testsuite, along with many initial .dat files. It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes were getting their upper & lower 16-bits reversed. There is a new Instruction sub-class, that is intended to be loaded from a .dat file rather than read from an executable. There is also a new EmulationStateARM class, for handling the before & after states. EmulationStates for other architetures can be added later when we emulate their instructions. llvm-svn: 129832
* Fix bug where source & target registers were swapped in anCaroline Tice2011-04-131-2/+2
| | | | | | emulation function. llvm-svn: 129474
* Fix various minor bugs in the ARM instruction emulation code.Caroline Tice2011-04-131-2/+11
| | | | llvm-svn: 129422
* Implement ARM emulation function to handle "SUBS PC, LR and related ↵Caroline Tice2011-04-112-43/+246
| | | | | | instructions". llvm-svn: 129279
* Fix various things in the instruction emulation code:Caroline Tice2011-04-081-7/+48
| | | | | | | | | | | | - Add ability to control whether or not the emulator advances the PC register (in the emulation state), if the instruction itself does not change the pc value.. - Fix a few typos in asm description strings. - Fix bug in the carry flag calculation. llvm-svn: 129168
* Add the ARM instruction emulation makefile.Stephen Wilson2011-04-081-0/+14
| | | | | | I forgot to 'svn add' this file in r129119. llvm-svn: 129120
* Add Emulate and DumpEmulation to Instruction class.Caroline Tice2011-04-051-1/+2
| | | | | | | | Move InstructionLLVM out of DisassemblerLLVM class. Add instruction emulation function calls to SBInstruction and SBInstructionList APIs. llvm-svn: 128956
* Add the rest of the mechanisms to make ARM instruction emulation ↵Caroline Tice2011-04-052-21/+232
| | | | | | usable/possible. llvm-svn: 128907
* Fix a few typos in the previous commit.Caroline Tice2011-03-312-9/+5
| | | | llvm-svn: 128671
* Add code to emulate VLD1 (single element to all lanes) ARM instruction.Caroline Tice2011-03-312-0/+141
| | | | llvm-svn: 128669
* Add code to emulate VST1 (single element from one lane) ARMCaroline Tice2011-03-311-2/+162
| | | | | | instruction (more floating point stores). llvm-svn: 128661
* Add code to emulate VST1 (multiple single elements) ARMCaroline Tice2011-03-311-8/+175
| | | | | | instruction (floating point store). llvm-svn: 128656
* Add code to emulate VLD1 (single element to one lane) floating pointCaroline Tice2011-03-311-2/+175
| | | | | | register load instruction (ARM) . llvm-svn: 128646
* Add code to emulate VLD1 (multiple single elements) ARM instruction.Caroline Tice2011-03-311-9/+178
| | | | llvm-svn: 128637
* Add code to emulate VSTR ARM instruction (store a floating point register).Caroline Tice2011-03-311-0/+137
| | | | llvm-svn: 128614
* Add code to emulate the VLDR Arm instruction (load a floating poitn register).Caroline Tice2011-03-311-0/+134
| | | | llvm-svn: 128613
* Add "Bits64" utility function.Caroline Tice2011-03-311-9/+210
| | | | | | Add code to emulate VSTM ARM instruction (store multiple floating point registers). llvm-svn: 128609
* Modify ARM instruction tables to allow for specifying floating point variants.Caroline Tice2011-03-312-276/+515
| | | | | | | | Add code to emulate VLDM ARM instruction (loading multiplt floating point registers). Add function declarations for other floating point instructions to emulate. llvm-svn: 128589
* Fill in code for EmulateSTRDImm and EmulateSTRDReg, to emulate theCaroline Tice2011-03-301-24/+273
| | | | | | STRD (immediate) and STRD (register) instructions. llvm-svn: 128570
* Many improvements to the Platform base class and subclasses. The base PlatformGreg Clayton2011-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | class now implements the Host functionality for a lot of things that make sense by default so that subclasses can check: int PlatformSubclass::Foo () { if (IsHost()) return Platform::Foo (); // Let the platform base class do the host specific stuff // Platform subclass specific code... int result = ... return result; } Added new functions to the platform: virtual const char *Platform::GetUserName (uint32_t uid); virtual const char *Platform::GetGroupName (uint32_t gid); The user and group names are cached locally so that remote platforms can avoid sending packets multiple times to resolve this information. Added the parent process ID to the ProcessInfo class. Added a new ProcessInfoMatch class which helps us to match processes up and changed the Host layer over to using this new class. The new class allows us to search for processs: 1 - by name (equal to, starts with, ends with, contains, and regex) 2 - by pid 3 - And further check for parent pid == value, uid == value, gid == value, euid == value, egid == value, arch == value, parent == value. This is all hookup up to the "platform process list" command which required adding dumping routines to dump process information. If the Host class implements the process lookup routines, you can now lists processes on your local machine: machine1.foo.com % lldb (lldb) platform process list PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME ====== ====== ========== ========== ========== ========== ======================== ============================ 99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge 94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker 94852 244 username usergroup username usergroup x86_64-apple-darwin Safari 94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode 92742 92710 username usergroup username usergroup i386-apple-darwin debugserver This of course also works remotely with the lldb-platform: machine1.foo.com % lldb-platform --listen 1234 machine2.foo.com % lldb (lldb) platform create remote-macosx Platform: remote-macosx Connected: no (lldb) platform connect connect://localhost:1444 Platform: remote-macosx Triple: x86_64-apple-darwin OS Version: 10.6.7 (10J869) Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 Hostname: machine1.foo.com Connected: yes (lldb) platform process list PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME ====== ====== ========== ========== ========== ========== ======================== ============================ 99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation 99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb 99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge 94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker 94852 244 username usergroup username usergroup x86_64-apple-darwin Safari The lldb-platform implements everything with the Host:: layer, so this should "just work" for linux. I will probably be adding more stuff to the Host layer for launching processes and attaching to processes so that this support should eventually just work as well. Modified the target to be able to be created with an architecture that differs from the main executable. This is needed for iOS debugging since we can have an "armv6" binary which can run on an "armv7" machine, so we want to be able to do: % lldb (lldb) platform create remote-ios (lldb) file --arch armv7 a.out Where "a.out" is an armv6 executable. The platform then can correctly decide to open all "armv7" images for all dependent shared libraries. Modified the disassembly to show the current PC value. Example output: (lldb) disassemble --frame a.out`main: 0x1eb7: pushl %ebp 0x1eb8: movl %esp, %ebp 0x1eba: pushl %ebx 0x1ebb: subl $20, %esp 0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18 0x1ec3: popl %ebx -> 0x1ec4: calll 0x1f12 ; getpid 0x1ec9: movl %eax, 4(%esp) 0x1ecd: leal 199(%ebx), %eax 0x1ed3: movl %eax, (%esp) 0x1ed6: calll 0x1f18 ; printf 0x1edb: leal 213(%ebx), %eax 0x1ee1: movl %eax, (%esp) 0x1ee4: calll 0x1f1e ; puts 0x1ee9: calll 0x1f0c ; getchar 0x1eee: movl $20, (%esp) 0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6 0x1efa: movl $12, %eax 0x1eff: addl $20, %esp 0x1f02: popl %ebx 0x1f03: leave 0x1f04: ret This can be handy when dealing with the new --line options that was recently added: (lldb) disassemble --line a.out`main + 13 at test.c:19 18 { -> 19 printf("Process: %i\n\n", getpid()); 20 puts("Press any key to continue..."); getchar(); -> 0x1ec4: calll 0x1f12 ; getpid 0x1ec9: movl %eax, 4(%esp) 0x1ecd: leal 199(%ebx), %eax 0x1ed3: movl %eax, (%esp) 0x1ed6: calll 0x1f18 ; printf Modified the ModuleList to have a lookup based solely on a UUID. Since the UUID is typically the MD5 checksum of a binary image, there is no need to give the path and architecture when searching for a pre-existing image in an image list. Now that we support remote debugging a bit better, our lldb_private::Module needs to be able to track what the original path for file was as the platform knows it, as well as where the file is locally. The module has the two following functions to retrieve both paths: const FileSpec &Module::GetFileSpec () const; const FileSpec &Module::GetPlatformFileSpec () const; llvm-svn: 128563
* Fill in EmulateLDRDRegister to emulate LDRD (register) instruction.Caroline Tice2011-03-301-416/+105
| | | | | | Remove stubs for functions not-to-be-implemented at the moment. llvm-svn: 128559
* Fill in EmulateLDRLImmediate to emulate the LDRD (immediate) ARM instruction.Caroline Tice2011-03-301-9/+137
| | | | llvm-svn: 128556
* Fix typo in previous check-in.Caroline Tice2011-03-301-1/+1
| | | | llvm-svn: 128549
* Fill in EmulateSTRImmARM to emulate the STR (immediate,ARM) instruction.Caroline Tice2011-03-301-1/+94
| | | | llvm-svn: 128528
* Fill in EmulateSTRBImmARM to emulate the STRB (immediate, ARM) instruction.Caroline Tice2011-03-301-8/+83
| | | | llvm-svn: 128527
* Fill in EmulateSTREX to emulate the STREX ARM instruction.Caroline Tice2011-03-301-1/+94
| | | | llvm-svn: 128525
* Fill in code in EmulateSUBReg to emulate the SUB (register) ARM instruction.Caroline Tice2011-03-291-2/+111
| | | | llvm-svn: 128508
* Fill in code in EmulateADDRegShift, to emulate the ADDCaroline Tice2011-03-292-3/+83
| | | | | | (register-shifted register) ARM instruction. llvm-svn: 128500
* Add subtraction context.Caroline Tice2011-03-292-65/+887
| | | | | | | | Add code to emulate SUB (SP minus register) ARM instruction. Add stubs for other ARM emulation functions that need to be written. llvm-svn: 128491
* Add missing encodings for EmulateMOVRdImm (MOV register) function.Caroline Tice2011-03-291-15/+63
| | | | llvm-svn: 128479
* Fix single quote characters throughout the ARM emulation stuff.Caroline Tice2011-03-281-274/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix bugs in various ARM istruction emulation functions: EmulateVPUSH - Fix context. - Fix bug calculating register numbers. EmulateVPOP - Fix context. - Fix bug calculating register numbers. EmulateShiftIMM - Fix bug in assert statement. EmulateLDMDA - Fix context. EmulateLDMDB - Fix context. EmulateLDMIB - Fix context. EmulateSTM - Fix bug calculating lowest_set_bit. EmulateSTMDA - Fix context. - Fix bug calculating lowest_set_bit. EmulateSTMDB - Fix context. - Fix bug calculating lowest_set_bit. EmulateSTMIB - FIx context EmulateLDRSBImmed - Fix test to match correction in corrected manual llvm-svn: 128409
* Made the lldb_private::Opcode struct into a real boy... I mean class.Greg Clayton2011-03-242-633/+351
| | | | | | | | | | | Modified the Disassembler::Instruction base class to contain an Opcode instance so that we can know the bytes for an instruction without needing to keep the data around. Modified the DisassemblerLLVM's instruction class to correctly extract the opcode bytes if all goes well. llvm-svn: 128248
* Fixed the LLDB build so that we can have private types, private enums andGreg Clayton2011-03-242-54/+54
| | | | | | | | 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
* Add missing encodings for EmulateLDRRtRnImm (ARM insn emulation funciton).Caroline Tice2011-03-241-22/+82
| | | | llvm-svn: 128229
* More fixes for ARM instruction emulation code:Caroline Tice2011-03-221-13/+36
| | | | | | | | - Remove duplicate write from EmulateLDRRtPCRelative. - Add a missing encoding to EmulateADDSPImm. - Fix minor problems in Thumb instruction tables. llvm-svn: 128115
* Split all of the core of LLDB.framework/lldb.so into aGreg Clayton2011-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | static archive that can be linked against. LLDB.framework/lldb.so exports a very controlled API. Splitting the API into a static library allows other tools (debugserver for now) to use the power of the LLDB debugger core, yet not export it as its API is not portable or maintainable. The Host layer and many of the other internal only APIs can now be statically linked against. Now LLDB.framework/lldb.so links against "liblldb-core.a" instead of compiling the .o files only for the shared library. This fix is only for compiling with Xcode as the Makefile based build already does this. The Xcode projecdt compiler has been changed to LLVM. Anyone using Xcode 3 will need to manually change the compiler back to GCC 4.2, or update to Xcode 4. llvm-svn: 127963
* Fix various small problems with EmulateInstructionARM::EmulateSTRRtSP.Caroline Tice2011-03-181-14/+39
| | | | llvm-svn: 127898
* Make all the codee that attempts to read the PC consistently useCaroline Tice2011-03-171-18/+17
| | | | | | | | | ReadCoreReg (which 'does the right thing', adding to pc when needed); fixed places in code where extra addition was being passed along. Fix bug in insn tables. llvm-svn: 127838
* Add code to emulate STRH (Register) Arm instruction.Caroline Tice2011-03-162-4/+197
| | | | | | | | Remove inaccurate comments from EmulateInstruction::Context definition. Fix contexts in a few arm instruction emulation routines. llvm-svn: 127770
* Fix various small bugs found in the instruction emulation functions.Caroline Tice2011-03-161-6/+10
| | | | llvm-svn: 127712
* LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provideGreg Clayton2011-03-081-19/+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 code to emulate RFE Arm instruction.Caroline Tice2011-03-032-2/+241
| | | | | | | | | Add new instruction context for RFE instruction. Add several new helper functions to help emulate RFE instruction (including CurrentModeIsPrivileged, BadMode, and CPSRWriteByInstr). llvm-svn: 126965
* Add code to emulate UXTH Arm instruction.Caroline Tice2011-03-031-2/+87
| | | | llvm-svn: 126954
OpenPOWER on IntegriCloud