diff options
Diffstat (limited to 'source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 4d56f6ea3ba1..f501e43b00d7 100644 --- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -539,6 +539,7 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) ConstString set_name; std::vector<uint32_t> value_regs; std::vector<uint32_t> invalidate_regs; + std::vector<uint8_t> dwarf_opcode_bytes; RegisterInfo reg_info = { NULL, // Name NULL, // Alt name 0, // byte size @@ -553,7 +554,9 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) reg_num // native register number }, NULL, - NULL + NULL, + NULL, // Dwarf expression opcode bytes pointer + 0 // Dwarf expression opcode bytes length }; while (response.GetNameColonValue(name, value)) @@ -638,6 +641,23 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force) { SplitCommaSeparatedRegisterNumberString(value, invalidate_regs, 16); } + else if (name.compare("dynamic_size_dwarf_expr_bytes") == 0) + { + size_t dwarf_opcode_len = value.length () / 2; + assert (dwarf_opcode_len > 0); + + dwarf_opcode_bytes.resize (dwarf_opcode_len); + StringExtractor opcode_extractor; + reg_info.dynamic_size_dwarf_len = dwarf_opcode_len; + + // Swap "value" over into "opcode_extractor" + opcode_extractor.GetStringRef ().swap (value); + uint32_t ret_val = opcode_extractor.GetHexBytesAvail (dwarf_opcode_bytes.data (), + dwarf_opcode_len); + assert (dwarf_opcode_len == ret_val); + + reg_info.dynamic_size_dwarf_expr_bytes = dwarf_opcode_bytes.data (); + } } reg_info.byte_offset = reg_offset; @@ -4373,6 +4393,7 @@ ParseRegisters (XMLNode feature_node, GdbServerTargetInfo &target_info, GDBRemot ConstString set_name; std::vector<uint32_t> value_regs; std::vector<uint32_t> invalidate_regs; + std::vector<uint8_t> dwarf_opcode_bytes; bool encoding_set = false; bool format_set = false; RegisterInfo reg_info = { NULL, // Name @@ -4389,10 +4410,12 @@ ParseRegisters (XMLNode feature_node, GdbServerTargetInfo &target_info, GDBRemot cur_reg_num // native register number }, NULL, - NULL + NULL, + NULL, // Dwarf Expression opcode bytes pointer + 0 // Dwarf Expression opcode bytes length }; - reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, ®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, ®_info, &cur_reg_num, ®_offset](const llvm::StringRef &name, const llvm::StringRef &value) -> bool { + reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, ®_name, &alt_name, &set_name, &value_regs, &invalidate_regs, &encoding_set, &format_set, ®_info, &cur_reg_num, ®_offset, &dwarf_opcode_bytes](const llvm::StringRef &name, const llvm::StringRef &value) -> bool { if (name == "name") { reg_name.SetString(value); @@ -4480,6 +4503,22 @@ ParseRegisters (XMLNode feature_node, GdbServerTargetInfo &target_info, GDBRemot { SplitCommaSeparatedRegisterNumberString(value, invalidate_regs, 0); } + else if (name == "dynamic_size_dwarf_expr_bytes") + { + StringExtractor opcode_extractor; + std::string opcode_string = value.str (); + size_t dwarf_opcode_len = opcode_string.length () / 2; + assert (dwarf_opcode_len > 0); + + dwarf_opcode_bytes.resize (dwarf_opcode_len); + reg_info.dynamic_size_dwarf_len = dwarf_opcode_len; + opcode_extractor.GetStringRef ().swap (opcode_string); + uint32_t ret_val = opcode_extractor.GetHexBytesAvail (dwarf_opcode_bytes.data (), + dwarf_opcode_len); + assert (dwarf_opcode_len == ret_val); + + reg_info.dynamic_size_dwarf_expr_bytes = dwarf_opcode_bytes.data (); + } else { printf("unhandled attribute %s = %s\n", name.data(), value.data()); |