diff options
author | Greg Clayton <gclayton@apple.com> | 2012-12-15 01:44:51 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-12-15 01:44:51 +0000 |
commit | 81409635e0e766371baeea7da805ff73c6c922df (patch) | |
tree | 27bc2c967b1e41271010dd3e1afb508c68c20c8d /lldb/source | |
parent | ddd282addbce7d6564de12fe74235fde9cd6f836 (diff) | |
download | bcm5719-llvm-81409635e0e766371baeea7da805ff73c6c922df.tar.gz bcm5719-llvm-81409635e0e766371baeea7da805ff73c6c922df.zip |
<rdar://problem/12156204>
x/a print wouldn't always reset the word size to the size of a pointer if a previous memory read using x/<gdb-format> had been used that set it to another width.
llvm-svn: 170264
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Interpreter/OptionGroupFormat.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp index 795fb038aca..226f5a16f98 100644 --- a/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -13,6 +13,10 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Core/ArchSpec.h" +#include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Target.h" #include "lldb/Utility/Utils.h" using namespace lldb; @@ -119,7 +123,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter, Format format = eFormatDefault; uint32_t byte_size = 0; - while (ParserGDBFormatLetter (gdb_format_cstr[0], format, byte_size)) + while (ParserGDBFormatLetter (interpreter, gdb_format_cstr[0], format, byte_size)) { ++gdb_format_cstr; } @@ -139,7 +143,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter, // Anything that wasn't set correctly should be set to the // previous default if (format == eFormatInvalid) - ParserGDBFormatLetter (m_prev_gdb_format, format, byte_size); + ParserGDBFormatLetter (interpreter, m_prev_gdb_format, format, byte_size); const bool byte_size_enabled = m_byte_size.GetDefaultValue() < UINT64_MAX; const bool count_enabled = m_count.GetDefaultValue() < UINT64_MAX; @@ -147,7 +151,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter, { // Byte size is enabled if (byte_size == 0) - ParserGDBFormatLetter (m_prev_gdb_size, format, byte_size); + ParserGDBFormatLetter (interpreter, m_prev_gdb_size, format, byte_size); } else { @@ -199,7 +203,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter, } bool -OptionGroupFormat::ParserGDBFormatLetter (char format_letter, Format &format, uint32_t &byte_size) +OptionGroupFormat::ParserGDBFormatLetter (CommandInterpreter &interpreter, char format_letter, Format &format, uint32_t &byte_size) { switch (format_letter) { @@ -209,7 +213,15 @@ OptionGroupFormat::ParserGDBFormatLetter (char format_letter, Format &format, ui case 'u': format = eFormatUnsigned; m_prev_gdb_format = format_letter; return true; case 't': format = eFormatBinary; m_prev_gdb_format = format_letter; return true; case 'f': format = eFormatFloat; m_prev_gdb_format = format_letter; return true; - case 'a': format = eFormatAddressInfo; m_prev_gdb_format = format_letter; return true; + case 'a': format = eFormatAddressInfo; + { + ExecutionContext exe_ctx(interpreter.GetExecutionContext()); + Target *target = exe_ctx.GetTargetPtr(); + if (target) + byte_size = target->GetArchitecture().GetAddressByteSize(); + m_prev_gdb_format = format_letter; + return true; + } case 'i': format = eFormatInstruction; m_prev_gdb_format = format_letter; return true; case 'c': format = eFormatChar; m_prev_gdb_format = format_letter; return true; case 's': format = eFormatCString; m_prev_gdb_format = format_letter; return true; |