llvm-project/lldb/source/Core
Greg Clayton 357132eb9a Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:

uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;

uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;

Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than 
once.

Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.

Changed:

	bool
	SymbolContextList::AppendIfUnique (const SymbolContext& sc);

To:
	bool
	SymbolContextList::AppendIfUnique (const SymbolContext& sc, 
									   bool merge_symbol_into_function);

This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.

Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").

Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump 
them and show the opcode bytes, we can format the output more 
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.

Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported 
architecture. I also added the ability to specify "thumb" as an 
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:

(lldb) disassemble --arch thumb --name main

You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080:  0xb580 push   {r7, lr}
0x100001082:  0xaf00 add    r7, sp, #0

Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.

llvm-svn: 128347
2011-03-26 19:14:58 +00:00
..
Address.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
AddressRange.cpp Made lldb_private::ArchSpec contain much more than just an architecture. It 2011-02-15 21:59:32 +00:00
AddressResolver.cpp
AddressResolverFileLine.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
AddressResolverName.cpp Changed the SymbolFile::FindFunction() function calls to only return 2011-01-27 06:44:37 +00:00
ArchSpec.cpp Added the ability to get the min and max instruction byte size for 2011-03-26 19:14:58 +00:00
Baton.cpp
Broadcaster.cpp Fixed a crasher when enabling logging that is due to the new hijack listener stack changes. 2011-02-10 06:51:22 +00:00
Communication.cpp Did a lot more work on abtracting and organizing the platforms. 2011-03-24 04:28:38 +00:00
Connection.cpp
ConnectionFileDescriptor.cpp Did a lot more work on abtracting and organizing the platforms. 2011-03-24 04:28:38 +00:00
ConstString.cpp Made many ConstString functions inlined in the header file. 2010-10-15 22:48:33 +00:00
DataBufferHeap.cpp
DataBufferMemoryMap.cpp Moved FileSpec into the Host layer since it will vary from host to host. 2011-02-08 05:05:52 +00:00
DataExtractor.cpp Applied a fix to qualify "UUID" with the lldb_private namespace to fix 2011-02-04 18:53:10 +00:00
Debugger.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
Disassembler.cpp Added the ability to get the min and max instruction byte size for 2011-03-26 19:14:58 +00:00
DynamicLoader.cpp The DynamicLoader plug-in instance now lives up in lldb_private::Process where 2011-02-16 04:46:07 +00:00
EmulateInstruction.cpp Made the lldb_private::Opcode struct into a real boy... I mean class. 2011-03-24 23:53:38 +00:00
Error.cpp LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provide 2011-03-08 22:40:15 +00:00
Event.cpp Endian patch from Kirk Beitz that allows better cross platform building. 2011-02-01 01:31:41 +00:00
FileSpecList.cpp Add missing includes. 2010-06-09 08:50:27 +00:00
InputReader.cpp Use Host::File in lldb_private::StreamFile and other places to cleanup host 2011-02-09 01:08:52 +00:00
Language.cpp Created lldb::LanguageType by moving an enumeration from the 2010-07-28 02:04:09 +00:00
Listener.cpp Modified all logging calls to hand out shared pointers to make sure we 2010-11-06 01:53:30 +00:00
Log.cpp Abtracted all mach-o and ELF out of ArchSpec. This patch is a modified form 2011-02-23 00:35:02 +00:00
Makefile Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Mangled.cpp Move the demangle-failed indication out a bit so other failing cases 2010-12-15 04:27:04 +00:00
Module.cpp Added the ability to get the min and max instruction byte size for 2011-03-26 19:14:58 +00:00
ModuleChild.cpp
ModuleList.cpp Added a fix to not re-use object files when doing DWARF with debug map. 2011-03-15 03:56:33 +00:00
Opcode.cpp Added the ability to get the min and max instruction byte size for 2011-03-26 19:14:58 +00:00
PluginManager.cpp Did a lot more work on abtracting and organizing the platforms. 2011-03-24 04:28:38 +00:00
RegularExpression.cpp Improved our argument parsing abilities to be able to handle stuff more like 2010-12-19 03:41:24 +00:00
Scalar.cpp Endian patch from Kirk Beitz that allows better cross platform building. 2011-02-01 01:31:41 +00:00
SearchFilter.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Section.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
SourceManager.cpp Fixed an issue in our source manager where we were permanently caching source 2010-12-08 20:16:12 +00:00
State.cpp Added support for attaching to a remote debug server with the new command: 2011-02-04 01:58:07 +00:00
Stream.cpp Use Host::File in lldb_private::StreamFile and other places to cleanup host 2011-02-09 01:08:52 +00:00
StreamFile.cpp Use Host::File in lldb_private::StreamFile and other places to cleanup host 2011-02-09 01:08:52 +00:00
StreamString.cpp Add missing includes. 2010-06-09 08:50:27 +00:00
StringList.cpp Declare some const functions as const. 2011-03-11 01:48:52 +00:00
Timer.cpp Added a setting to "log timer" so you can see the incremental timings as well: 2010-11-04 23:19:21 +00:00
UUID.cpp Header patch, virtual dtor patch and missed UUID patch from Kirk Beitz. 2011-02-05 02:56:16 +00:00
UserID.cpp Move trivial parts of UserID into the header. 2010-06-22 10:44:12 +00:00
UserSettingsController.cpp - Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting 2011-02-19 02:53:09 +00:00
VMRange.cpp Added support for inlined stack frames being represented as real stack frames 2010-08-24 00:45:41 +00:00
Value.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
ValueObject.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
ValueObjectChild.cpp Fixed up the SBValue::GetExpressionPath() to be more correct under more 2011-01-21 01:59:00 +00:00
ValueObjectConstResult.cpp Fixed the LLDB build so that we can have private types, private enums and 2011-03-24 21:19:54 +00:00
ValueObjectList.cpp StackFrame objects now own ValueObjects for any frame variables (locals, args, 2010-09-02 02:59:18 +00:00
ValueObjectRegister.cpp A few of the issue I have been trying to track down and fix have been due to 2011-01-17 03:46:26 +00:00
ValueObjectVariable.cpp Made lldb_private::ArchSpec contain much more than just an architecture. It 2011-02-15 21:59:32 +00:00