GDBRemoteRegisterContext.cpp revision 516f0849819d094d4eab39a1f27b770259103ff8
1//===-- GDBRemoteRegisterContext.cpp ----------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include "GDBRemoteRegisterContext.h" 11 12// C Includes 13// C++ Includes 14// Other libraries and framework includes 15#include "lldb/Core/DataBufferHeap.h" 16#include "lldb/Core/DataExtractor.h" 17#include "lldb/Core/RegisterValue.h" 18#include "lldb/Core/Scalar.h" 19#include "lldb/Core/StreamString.h" 20#include "lldb/Target/ExecutionContext.h" 21// Project includes 22#include "Utility/StringExtractorGDBRemote.h" 23#include "ProcessGDBRemote.h" 24#include "ThreadGDBRemote.h" 25#include "Utility/ARM_GCC_Registers.h" 26#include "Utility/ARM_DWARF_Registers.h" 27 28using namespace lldb; 29using namespace lldb_private; 30 31//---------------------------------------------------------------------- 32// GDBRemoteRegisterContext constructor 33//---------------------------------------------------------------------- 34GDBRemoteRegisterContext::GDBRemoteRegisterContext 35( 36 ThreadGDBRemote &thread, 37 uint32_t concrete_frame_idx, 38 GDBRemoteDynamicRegisterInfo ®_info, 39 bool read_all_at_once 40) : 41 RegisterContext (thread, concrete_frame_idx), 42 m_reg_info (reg_info), 43 m_reg_valid (), 44 m_reg_data (), 45 m_read_all_at_once (read_all_at_once) 46{ 47 // Resize our vector of bools to contain one bool for every register. 48 // We will use these boolean values to know when a register value 49 // is valid in m_reg_data. 50 m_reg_valid.resize (reg_info.GetNumRegisters()); 51 52 // Make a heap based buffer that is big enough to store all registers 53 DataBufferSP reg_data_sp(new DataBufferHeap (reg_info.GetRegisterDataByteSize(), 0)); 54 m_reg_data.SetData (reg_data_sp); 55 56} 57 58//---------------------------------------------------------------------- 59// Destructor 60//---------------------------------------------------------------------- 61GDBRemoteRegisterContext::~GDBRemoteRegisterContext() 62{ 63} 64 65void 66GDBRemoteRegisterContext::InvalidateAllRegisters () 67{ 68 SetAllRegisterValid (false); 69} 70 71void 72GDBRemoteRegisterContext::SetAllRegisterValid (bool b) 73{ 74 std::vector<bool>::iterator pos, end = m_reg_valid.end(); 75 for (pos = m_reg_valid.begin(); pos != end; ++pos) 76 *pos = b; 77} 78 79size_t 80GDBRemoteRegisterContext::GetRegisterCount () 81{ 82 return m_reg_info.GetNumRegisters (); 83} 84 85const RegisterInfo * 86GDBRemoteRegisterContext::GetRegisterInfoAtIndex (uint32_t reg) 87{ 88 return m_reg_info.GetRegisterInfoAtIndex (reg); 89} 90 91size_t 92GDBRemoteRegisterContext::GetRegisterSetCount () 93{ 94 return m_reg_info.GetNumRegisterSets (); 95} 96 97 98 99const RegisterSet * 100GDBRemoteRegisterContext::GetRegisterSet (uint32_t reg_set) 101{ 102 return m_reg_info.GetRegisterSet (reg_set); 103} 104 105 106 107bool 108GDBRemoteRegisterContext::ReadRegister (const RegisterInfo *reg_info, RegisterValue &value) 109{ 110 // Read the register 111 if (ReadRegisterBytes (reg_info, m_reg_data)) 112 { 113 const bool partial_data_ok = false; 114 Error error (value.SetValueFromData(reg_info, m_reg_data, reg_info->byte_offset, partial_data_ok)); 115 return error.Success(); 116 } 117 return false; 118} 119 120bool 121GDBRemoteRegisterContext::PrivateSetRegisterValue (uint32_t reg, StringExtractor &response) 122{ 123 const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg); 124 if (reg_info == NULL) 125 return false; 126 127 // Invalidate if needed 128 InvalidateIfNeeded(false); 129 130 const uint32_t reg_byte_size = reg_info->byte_size; 131 const size_t bytes_copied = response.GetHexBytes (const_cast<uint8_t*>(m_reg_data.PeekData(reg_info->byte_offset, reg_byte_size)), reg_byte_size, '\xcc'); 132 bool success = bytes_copied == reg_byte_size; 133 if (success) 134 { 135 m_reg_valid[reg] = true; 136 } 137 else if (bytes_copied > 0) 138 { 139 // Only set register is valid to false if we copied some bytes, else 140 // leave it as it was. 141 m_reg_valid[reg] = false; 142 } 143 return success; 144} 145 146// Helper function for GDBRemoteRegisterContext::ReadRegisterBytes(). 147bool 148GDBRemoteRegisterContext::GetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, 149 GDBRemoteCommunicationClient &gdb_comm) 150{ 151 char packet[64]; 152 StringExtractorGDBRemote response; 153 int packet_len = 0; 154 const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; 155 if (gdb_comm.GetThreadSuffixSupported()) 156 packet_len = ::snprintf (packet, sizeof(packet), "p%x;thread:%4.4llx;", reg, m_thread.GetID()); 157 else 158 packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg); 159 assert (packet_len < (sizeof(packet) - 1)); 160 if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false)) 161 return PrivateSetRegisterValue (reg, response); 162 163 return false; 164} 165bool 166GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataExtractor &data) 167{ 168 ExecutionContext exe_ctx (CalculateThread()); 169 170 Process *process = exe_ctx.GetProcessPtr(); 171 Thread *thread = exe_ctx.GetThreadPtr(); 172 if (process == NULL || thread == NULL) 173 return false; 174 175 GDBRemoteCommunicationClient &gdb_comm (((ProcessGDBRemote *)process)->GetGDBRemote()); 176 177 InvalidateIfNeeded(false); 178 179 const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; 180 181 if (!m_reg_valid[reg]) 182 { 183 Mutex::Locker locker; 184 if (gdb_comm.GetSequenceMutex (locker, 0)) 185 { 186 const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); 187 ProcessSP process_sp (m_thread.GetProcess()); 188 if (thread_suffix_supported || static_cast<ProcessGDBRemote *>(process_sp.get())->GetGDBRemote().SetCurrentThread(m_thread.GetID())) 189 { 190 char packet[64]; 191 StringExtractorGDBRemote response; 192 int packet_len = 0; 193 if (m_read_all_at_once) 194 { 195 // Get all registers in one packet 196 if (thread_suffix_supported) 197 packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4llx;", m_thread.GetID()); 198 else 199 packet_len = ::snprintf (packet, sizeof(packet), "g"); 200 assert (packet_len < (sizeof(packet) - 1)); 201 if (gdb_comm.SendPacketAndWaitForResponse(packet, response, false)) 202 { 203 if (response.IsNormalResponse()) 204 if (response.GetHexBytes ((void *)m_reg_data.GetDataStart(), m_reg_data.GetByteSize(), '\xcc') == m_reg_data.GetByteSize()) 205 SetAllRegisterValid (true); 206 } 207 } 208 else if (!reg_info->value_regs) 209 { 210 // Get each register individually 211 GetPrimordialRegister(reg_info, gdb_comm); 212 } 213 else 214 { 215 // Process this composite register request by delegating to the constituent 216 // primordial registers. 217 218 // Index of the primordial register. 219 uint32_t prim_reg_idx; 220 bool success = true; 221 for (uint32_t idx = 0; 222 (prim_reg_idx = reg_info->value_regs[idx]) != LLDB_INVALID_REGNUM; 223 ++idx) 224 { 225 // We have a valid primordial regsiter as our constituent. 226 // Grab the corresponding register info. 227 const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg_idx); 228 if (!GetPrimordialRegister(prim_reg_info, gdb_comm)) 229 { 230 success = false; 231 // Some failure occurred. Let's break out of the for loop. 232 break; 233 } 234 } 235 if (success) 236 { 237 // If we reach this point, all primordial register requests have succeeded. 238 // Validate this composite register. 239 m_reg_valid[reg_info->kinds[eRegisterKindLLDB]] = true; 240 } 241 } 242 } 243 } 244 245 // Make sure we got a valid register value after reading it 246 if (!m_reg_valid[reg]) 247 return false; 248 } 249 250 if (&data != &m_reg_data) 251 { 252 // If we aren't extracting into our own buffer (which 253 // only happens when this function is called from 254 // ReadRegisterValue(uint32_t, Scalar&)) then 255 // we transfer bytes from our buffer into the data 256 // buffer that was passed in 257 data.SetByteOrder (m_reg_data.GetByteOrder()); 258 data.SetData (m_reg_data, reg_info->byte_offset, reg_info->byte_size); 259 } 260 return true; 261} 262 263 264bool 265GDBRemoteRegisterContext::WriteRegister (const RegisterInfo *reg_info, 266 const RegisterValue &value) 267{ 268 DataExtractor data; 269 if (value.GetData (data)) 270 return WriteRegisterBytes (reg_info, data, 0); 271 return false; 272} 273 274// Helper function for GDBRemoteRegisterContext::WriteRegisterBytes(). 275bool 276GDBRemoteRegisterContext::SetPrimordialRegister(const lldb_private::RegisterInfo *reg_info, 277 GDBRemoteCommunicationClient &gdb_comm) 278{ 279 StreamString packet; 280 StringExtractorGDBRemote response; 281 const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; 282 packet.Printf ("P%x=", reg); 283 packet.PutBytesAsRawHex8 (m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size), 284 reg_info->byte_size, 285 lldb::endian::InlHostByteOrder(), 286 lldb::endian::InlHostByteOrder()); 287 288 if (gdb_comm.GetThreadSuffixSupported()) 289 packet.Printf (";thread:%4.4llx;", m_thread.GetID()); 290 291 // Invalidate just this register 292 m_reg_valid[reg] = false; 293 if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), 294 packet.GetString().size(), 295 response, 296 false)) 297 { 298 if (response.IsOKResponse()) 299 return true; 300 } 301 return false; 302} 303bool 304GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *reg_info, DataExtractor &data, uint32_t data_offset) 305{ 306 ExecutionContext exe_ctx (CalculateThread()); 307 308 Process *process = exe_ctx.GetProcessPtr(); 309 Thread *thread = exe_ctx.GetThreadPtr(); 310 if (process == NULL || thread == NULL) 311 return false; 312 313 GDBRemoteCommunicationClient &gdb_comm (((ProcessGDBRemote *)process)->GetGDBRemote()); 314// FIXME: This check isn't right because IsRunning checks the Public state, but this 315// is work you need to do - for instance in ShouldStop & friends - before the public 316// state has been changed. 317// if (gdb_comm.IsRunning()) 318// return false; 319 320 // Grab a pointer to where we are going to put this register 321 uint8_t *dst = const_cast<uint8_t*>(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)); 322 323 if (dst == NULL) 324 return false; 325 326 327 if (data.CopyByteOrderedData (data_offset, // src offset 328 reg_info->byte_size, // src length 329 dst, // dst 330 reg_info->byte_size, // dst length 331 m_reg_data.GetByteOrder())) // dst byte order 332 { 333 Mutex::Locker locker; 334 if (gdb_comm.GetSequenceMutex (locker, 0)) 335 { 336 const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); 337 ProcessSP process_sp (m_thread.GetProcess()); 338 if (thread_suffix_supported || static_cast<ProcessGDBRemote *>(process_sp.get())->GetGDBRemote().SetCurrentThread(m_thread.GetID())) 339 { 340 uint32_t offset, end_offset; 341 StreamString packet; 342 StringExtractorGDBRemote response; 343 if (m_read_all_at_once) 344 { 345 // Set all registers in one packet 346 packet.PutChar ('G'); 347 offset = 0; 348 end_offset = m_reg_data.GetByteSize(); 349 350 packet.PutBytesAsRawHex8 (m_reg_data.GetDataStart(), 351 m_reg_data.GetByteSize(), 352 lldb::endian::InlHostByteOrder(), 353 lldb::endian::InlHostByteOrder()); 354 355 if (thread_suffix_supported) 356 packet.Printf (";thread:%4.4llx;", m_thread.GetID()); 357 358 // Invalidate all register values 359 InvalidateIfNeeded (true); 360 361 if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), 362 packet.GetString().size(), 363 response, 364 false)) 365 { 366 SetAllRegisterValid (false); 367 if (response.IsOKResponse()) 368 { 369 return true; 370 } 371 } 372 } 373 else if (!reg_info->value_regs) 374 { 375 // Set each register individually 376 return SetPrimordialRegister(reg_info, gdb_comm); 377 } 378 else 379 { 380 // Process this composite register request by delegating to the constituent 381 // primordial registers. 382 383 // Invalidate this composite register first. 384 m_reg_valid[reg_info->kinds[eRegisterKindLLDB]] = false; 385 386 // Index of the primordial register. 387 uint32_t prim_reg_idx; 388 // For loop index. 389 uint32_t idx; 390 391 // Invalidate the invalidate_regs, if present. 392 if (reg_info->invalidate_regs) 393 { 394 for (idx = 0; 395 (prim_reg_idx = reg_info->invalidate_regs[idx]) != LLDB_INVALID_REGNUM; 396 ++idx) 397 { 398 // Grab the invalidate register info. 399 const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg_idx); 400 m_reg_valid[prim_reg_info->kinds[eRegisterKindLLDB]] = false; 401 } 402 } 403 404 bool success = true; 405 for (idx = 0; 406 (prim_reg_idx = reg_info->value_regs[idx]) != LLDB_INVALID_REGNUM; 407 ++idx) 408 { 409 // We have a valid primordial regsiter as our constituent. 410 // Grab the corresponding register info. 411 const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg_idx); 412 if (!SetPrimordialRegister(prim_reg_info, gdb_comm)) 413 { 414 success = false; 415 // Some failure occurred. Let's break out of the for loop. 416 break; 417 } 418 } 419 return success; 420 } 421 } 422 } 423 } 424 return false; 425} 426 427 428bool 429GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) 430{ 431 ExecutionContext exe_ctx (CalculateThread()); 432 433 Process *process = exe_ctx.GetProcessPtr(); 434 Thread *thread = exe_ctx.GetThreadPtr(); 435 if (process == NULL || thread == NULL) 436 return false; 437 438 GDBRemoteCommunicationClient &gdb_comm (((ProcessGDBRemote *)process)->GetGDBRemote()); 439 440 StringExtractorGDBRemote response; 441 442 Mutex::Locker locker; 443 if (gdb_comm.GetSequenceMutex (locker, 0)) 444 { 445 char packet[32]; 446 const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); 447 ProcessSP process_sp (m_thread.GetProcess()); 448 if (thread_suffix_supported || static_cast<ProcessGDBRemote *>(process_sp.get())->GetGDBRemote().SetCurrentThread(m_thread.GetID())) 449 { 450 int packet_len = 0; 451 if (thread_suffix_supported) 452 packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4llx", m_thread.GetID()); 453 else 454 packet_len = ::snprintf (packet, sizeof(packet), "g"); 455 assert (packet_len < (sizeof(packet) - 1)); 456 457 if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false)) 458 { 459 if (response.IsErrorResponse()) 460 return false; 461 462 std::string &response_str = response.GetStringRef(); 463 if (isxdigit(response_str[0])) 464 { 465 response_str.insert(0, 1, 'G'); 466 if (thread_suffix_supported) 467 { 468 char thread_id_cstr[64]; 469 ::snprintf (thread_id_cstr, sizeof(thread_id_cstr), ";thread:%4.4llx;", m_thread.GetID()); 470 response_str.append (thread_id_cstr); 471 } 472 data_sp.reset (new DataBufferHeap (response_str.c_str(), response_str.size())); 473 return true; 474 } 475 } 476 } 477 } 478 data_sp.reset(); 479 return false; 480} 481 482bool 483GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) 484{ 485 if (!data_sp || data_sp->GetBytes() == NULL || data_sp->GetByteSize() == 0) 486 return false; 487 488 ExecutionContext exe_ctx (CalculateThread()); 489 490 Process *process = exe_ctx.GetProcessPtr(); 491 Thread *thread = exe_ctx.GetThreadPtr(); 492 if (process == NULL || thread == NULL) 493 return false; 494 495 GDBRemoteCommunicationClient &gdb_comm (((ProcessGDBRemote *)process)->GetGDBRemote()); 496 497 StringExtractorGDBRemote response; 498 Mutex::Locker locker; 499 if (gdb_comm.GetSequenceMutex (locker, 0)) 500 { 501 const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); 502 ProcessSP process_sp (m_thread.GetProcess()); 503 if (thread_suffix_supported || static_cast<ProcessGDBRemote *>(process_sp.get())->GetGDBRemote().SetCurrentThread(m_thread.GetID())) 504 { 505 // The data_sp contains the entire G response packet including the 506 // G, and if the thread suffix is supported, it has the thread suffix 507 // as well. 508 const char *G_packet = (const char *)data_sp->GetBytes(); 509 size_t G_packet_len = data_sp->GetByteSize(); 510 if (gdb_comm.SendPacketAndWaitForResponse (G_packet, 511 G_packet_len, 512 response, 513 false)) 514 { 515 if (response.IsOKResponse()) 516 return true; 517 else if (response.IsErrorResponse()) 518 { 519 uint32_t num_restored = 0; 520 // We need to manually go through all of the registers and 521 // restore them manually 522 523 response.GetStringRef().assign (G_packet, G_packet_len); 524 response.SetFilePos(1); // Skip the leading 'G' 525 DataBufferHeap buffer (m_reg_data.GetByteSize(), 0); 526 DataExtractor restore_data (buffer.GetBytes(), 527 buffer.GetByteSize(), 528 m_reg_data.GetByteOrder(), 529 m_reg_data.GetAddressByteSize()); 530 531 const uint32_t bytes_extracted = response.GetHexBytes ((void *)restore_data.GetDataStart(), 532 restore_data.GetByteSize(), 533 '\xcc'); 534 535 if (bytes_extracted < restore_data.GetByteSize()) 536 restore_data.SetData(restore_data.GetDataStart(), bytes_extracted, m_reg_data.GetByteOrder()); 537 538 //ReadRegisterBytes (const RegisterInfo *reg_info, RegisterValue &value, DataExtractor &data) 539 const RegisterInfo *reg_info; 540 // We have to march the offset of each register along in the 541 // buffer to make sure we get the right offset. 542 uint32_t reg_byte_offset = 0; 543 for (uint32_t reg_idx=0; (reg_info = GetRegisterInfoAtIndex (reg_idx)) != NULL; ++reg_idx, reg_byte_offset += reg_info->byte_size) 544 { 545 const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; 546 547 // Skip composite registers. 548 if (reg_info->value_regs) 549 continue; 550 551 // Only write down the registers that need to be written 552 // if we are going to be doing registers individually. 553 bool write_reg = true; 554 const uint32_t reg_byte_size = reg_info->byte_size; 555 556 const char *restore_src = (const char *)restore_data.PeekData(reg_byte_offset, reg_byte_size); 557 if (restore_src) 558 { 559 if (m_reg_valid[reg]) 560 { 561 const char *current_src = (const char *)m_reg_data.PeekData(reg_byte_offset, reg_byte_size); 562 if (current_src) 563 write_reg = memcmp (current_src, restore_src, reg_byte_size) != 0; 564 } 565 566 if (write_reg) 567 { 568 StreamString packet; 569 packet.Printf ("P%x=", reg); 570 packet.PutBytesAsRawHex8 (restore_src, 571 reg_byte_size, 572 lldb::endian::InlHostByteOrder(), 573 lldb::endian::InlHostByteOrder()); 574 575 if (thread_suffix_supported) 576 packet.Printf (";thread:%4.4llx;", m_thread.GetID()); 577 578 m_reg_valid[reg] = false; 579 if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), 580 packet.GetString().size(), 581 response, 582 false)) 583 { 584 if (response.IsOKResponse()) 585 ++num_restored; 586 } 587 } 588 } 589 } 590 return num_restored > 0; 591 } 592 } 593 } 594 } 595 return false; 596} 597 598 599uint32_t 600GDBRemoteRegisterContext::ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) 601{ 602 return m_reg_info.ConvertRegisterKindToRegisterNumber (kind, num); 603} 604 605void 606GDBRemoteDynamicRegisterInfo::HardcodeARMRegisters() 607{ 608 // For Advanced SIMD and VFP register mapping. 609 static uint32_t g_d0_regs[] = { 26, 27, LLDB_INVALID_REGNUM }; // (s0, s1) 610 static uint32_t g_d1_regs[] = { 28, 29, LLDB_INVALID_REGNUM }; // (s2, s3) 611 static uint32_t g_d2_regs[] = { 30, 31, LLDB_INVALID_REGNUM }; // (s4, s5) 612 static uint32_t g_d3_regs[] = { 32, 33, LLDB_INVALID_REGNUM }; // (s6, s7) 613 static uint32_t g_d4_regs[] = { 34, 35, LLDB_INVALID_REGNUM }; // (s8, s9) 614 static uint32_t g_d5_regs[] = { 36, 37, LLDB_INVALID_REGNUM }; // (s10, s11) 615 static uint32_t g_d6_regs[] = { 38, 39, LLDB_INVALID_REGNUM }; // (s12, s13) 616 static uint32_t g_d7_regs[] = { 40, 41, LLDB_INVALID_REGNUM }; // (s14, s15) 617 static uint32_t g_d8_regs[] = { 42, 43, LLDB_INVALID_REGNUM }; // (s16, s17) 618 static uint32_t g_d9_regs[] = { 44, 45, LLDB_INVALID_REGNUM }; // (s18, s19) 619 static uint32_t g_d10_regs[] = { 46, 47, LLDB_INVALID_REGNUM }; // (s20, s21) 620 static uint32_t g_d11_regs[] = { 48, 49, LLDB_INVALID_REGNUM }; // (s22, s23) 621 static uint32_t g_d12_regs[] = { 50, 51, LLDB_INVALID_REGNUM }; // (s24, s25) 622 static uint32_t g_d13_regs[] = { 52, 53, LLDB_INVALID_REGNUM }; // (s26, s27) 623 static uint32_t g_d14_regs[] = { 54, 55, LLDB_INVALID_REGNUM }; // (s28, s29) 624 static uint32_t g_d15_regs[] = { 56, 57, LLDB_INVALID_REGNUM }; // (s30, s31) 625 static uint32_t g_q0_regs[] = { 26, 27, 28, 29, LLDB_INVALID_REGNUM }; // (d0, d1) -> (s0, s1, s2, s3) 626 static uint32_t g_q1_regs[] = { 30, 31, 32, 33, LLDB_INVALID_REGNUM }; // (d2, d3) -> (s4, s5, s6, s7) 627 static uint32_t g_q2_regs[] = { 34, 35, 36, 37, LLDB_INVALID_REGNUM }; // (d4, d5) -> (s8, s9, s10, s11) 628 static uint32_t g_q3_regs[] = { 38, 39, 40, 41, LLDB_INVALID_REGNUM }; // (d6, d7) -> (s12, s13, s14, s15) 629 static uint32_t g_q4_regs[] = { 42, 43, 44, 45, LLDB_INVALID_REGNUM }; // (d8, d9) -> (s16, s17, s18, s19) 630 static uint32_t g_q5_regs[] = { 46, 47, 48, 49, LLDB_INVALID_REGNUM }; // (d10, d11) -> (s20, s21, s22, s23) 631 static uint32_t g_q6_regs[] = { 50, 51, 52, 53, LLDB_INVALID_REGNUM }; // (d12, d13) -> (s24, s25, s26, s27) 632 static uint32_t g_q7_regs[] = { 54, 55, 56, 57, LLDB_INVALID_REGNUM }; // (d14, d15) -> (s28, s29, s30, s31) 633 static uint32_t g_q8_regs[] = { 59, 60, LLDB_INVALID_REGNUM }; // (d16, d17) 634 static uint32_t g_q9_regs[] = { 61, 62, LLDB_INVALID_REGNUM }; // (d18, d19) 635 static uint32_t g_q10_regs[] = { 63, 64, LLDB_INVALID_REGNUM }; // (d20, d21) 636 static uint32_t g_q11_regs[] = { 65, 66, LLDB_INVALID_REGNUM }; // (d22, d23) 637 static uint32_t g_q12_regs[] = { 67, 68, LLDB_INVALID_REGNUM }; // (d24, d25) 638 static uint32_t g_q13_regs[] = { 69, 70, LLDB_INVALID_REGNUM }; // (d26, d27) 639 static uint32_t g_q14_regs[] = { 71, 72, LLDB_INVALID_REGNUM }; // (d28, d29) 640 static uint32_t g_q15_regs[] = { 73, 74, LLDB_INVALID_REGNUM }; // (d30, d31) 641 642 static RegisterInfo g_register_infos[] = { 643// NAME ALT SZ OFF ENCODING FORMAT COMPILER DWARF GENERIC GDB LLDB VALUE REGS INVALIDATE REGS 644// ====== ====== === === ============= ============ =================== =================== ====================== === ==== ========== =============== 645 { "r0", "arg1", 4, 0, eEncodingUint, eFormatHex, { gcc_r0, dwarf_r0, LLDB_REGNUM_GENERIC_ARG1,0, 0 }, NULL, NULL}, 646 { "r1", "arg2", 4, 0, eEncodingUint, eFormatHex, { gcc_r1, dwarf_r1, LLDB_REGNUM_GENERIC_ARG2,1, 1 }, NULL, NULL}, 647 { "r2", "arg3", 4, 0, eEncodingUint, eFormatHex, { gcc_r2, dwarf_r2, LLDB_REGNUM_GENERIC_ARG3,2, 2 }, NULL, NULL}, 648 { "r3", "arg4", 4, 0, eEncodingUint, eFormatHex, { gcc_r3, dwarf_r3, LLDB_REGNUM_GENERIC_ARG4,3, 3 }, NULL, NULL}, 649 { "r4", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r4, dwarf_r4, LLDB_INVALID_REGNUM, 4, 4 }, NULL, NULL}, 650 { "r5", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r5, dwarf_r5, LLDB_INVALID_REGNUM, 5, 5 }, NULL, NULL}, 651 { "r6", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r6, dwarf_r6, LLDB_INVALID_REGNUM, 6, 6 }, NULL, NULL}, 652 { "r7", "fp", 4, 0, eEncodingUint, eFormatHex, { gcc_r7, dwarf_r7, LLDB_REGNUM_GENERIC_FP, 7, 7 }, NULL, NULL}, 653 { "r8", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r8, dwarf_r8, LLDB_INVALID_REGNUM, 8, 8 }, NULL, NULL}, 654 { "r9", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r9, dwarf_r9, LLDB_INVALID_REGNUM, 9, 9 }, NULL, NULL}, 655 { "r10", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r10, dwarf_r10, LLDB_INVALID_REGNUM, 10, 10 }, NULL, NULL}, 656 { "r11", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r11, dwarf_r11, LLDB_INVALID_REGNUM, 11, 11 }, NULL, NULL}, 657 { "r12", NULL, 4, 0, eEncodingUint, eFormatHex, { gcc_r12, dwarf_r12, LLDB_INVALID_REGNUM, 12, 12 }, NULL, NULL}, 658 { "sp", "r13", 4, 0, eEncodingUint, eFormatHex, { gcc_sp, dwarf_sp, LLDB_REGNUM_GENERIC_SP, 13, 13 }, NULL, NULL}, 659 { "lr", "r14", 4, 0, eEncodingUint, eFormatHex, { gcc_lr, dwarf_lr, LLDB_REGNUM_GENERIC_RA, 14, 14 }, NULL, NULL}, 660 { "pc", "r15", 4, 0, eEncodingUint, eFormatHex, { gcc_pc, dwarf_pc, LLDB_REGNUM_GENERIC_PC, 15, 15 }, NULL, NULL}, 661 { "f0", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 16, 16 }, NULL, NULL}, 662 { "f1", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 17, 17 }, NULL, NULL}, 663 { "f2", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 18, 18 }, NULL, NULL}, 664 { "f3", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 19, 19 }, NULL, NULL}, 665 { "f4", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 20, 20 }, NULL, NULL}, 666 { "f5", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 21, 21 }, NULL, NULL}, 667 { "f6", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 22, 22 }, NULL, NULL}, 668 { "f7", NULL, 12, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 23, 23 }, NULL, NULL}, 669 { "fps", NULL, 4, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 24, 24 }, NULL, NULL}, 670 { "cpsr","flags", 4, 0, eEncodingUint, eFormatHex, { gcc_cpsr, dwarf_cpsr, LLDB_INVALID_REGNUM, 25, 25 }, NULL, NULL}, 671 { "s0", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s0, LLDB_INVALID_REGNUM, 26, 26 }, NULL, NULL}, 672 { "s1", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s1, LLDB_INVALID_REGNUM, 27, 27 }, NULL, NULL}, 673 { "s2", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s2, LLDB_INVALID_REGNUM, 28, 28 }, NULL, NULL}, 674 { "s3", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s3, LLDB_INVALID_REGNUM, 29, 29 }, NULL, NULL}, 675 { "s4", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s4, LLDB_INVALID_REGNUM, 30, 30 }, NULL, NULL}, 676 { "s5", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s5, LLDB_INVALID_REGNUM, 31, 31 }, NULL, NULL}, 677 { "s6", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s6, LLDB_INVALID_REGNUM, 32, 32 }, NULL, NULL}, 678 { "s7", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s7, LLDB_INVALID_REGNUM, 33, 33 }, NULL, NULL}, 679 { "s8", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s8, LLDB_INVALID_REGNUM, 34, 34 }, NULL, NULL}, 680 { "s9", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s9, LLDB_INVALID_REGNUM, 35, 35 }, NULL, NULL}, 681 { "s10", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s10, LLDB_INVALID_REGNUM, 36, 36 }, NULL, NULL}, 682 { "s11", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s11, LLDB_INVALID_REGNUM, 37, 37 }, NULL, NULL}, 683 { "s12", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s12, LLDB_INVALID_REGNUM, 38, 38 }, NULL, NULL}, 684 { "s13", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s13, LLDB_INVALID_REGNUM, 39, 39 }, NULL, NULL}, 685 { "s14", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s14, LLDB_INVALID_REGNUM, 40, 40 }, NULL, NULL}, 686 { "s15", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s15, LLDB_INVALID_REGNUM, 41, 41 }, NULL, NULL}, 687 { "s16", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s16, LLDB_INVALID_REGNUM, 42, 42 }, NULL, NULL}, 688 { "s17", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s17, LLDB_INVALID_REGNUM, 43, 43 }, NULL, NULL}, 689 { "s18", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s18, LLDB_INVALID_REGNUM, 44, 44 }, NULL, NULL}, 690 { "s19", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s19, LLDB_INVALID_REGNUM, 45, 45 }, NULL, NULL}, 691 { "s20", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s20, LLDB_INVALID_REGNUM, 46, 46 }, NULL, NULL}, 692 { "s21", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s21, LLDB_INVALID_REGNUM, 47, 47 }, NULL, NULL}, 693 { "s22", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s22, LLDB_INVALID_REGNUM, 48, 48 }, NULL, NULL}, 694 { "s23", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s23, LLDB_INVALID_REGNUM, 49, 49 }, NULL, NULL}, 695 { "s24", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s24, LLDB_INVALID_REGNUM, 50, 50 }, NULL, NULL}, 696 { "s25", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s25, LLDB_INVALID_REGNUM, 51, 51 }, NULL, NULL}, 697 { "s26", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s26, LLDB_INVALID_REGNUM, 52, 52 }, NULL, NULL}, 698 { "s27", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s27, LLDB_INVALID_REGNUM, 53, 53 }, NULL, NULL}, 699 { "s28", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s28, LLDB_INVALID_REGNUM, 54, 54 }, NULL, NULL}, 700 { "s29", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s29, LLDB_INVALID_REGNUM, 55, 55 }, NULL, NULL}, 701 { "s30", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s30, LLDB_INVALID_REGNUM, 56, 56 }, NULL, NULL}, 702 { "s31", NULL, 4, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_s31, LLDB_INVALID_REGNUM, 57, 57 }, NULL, NULL}, 703 { "fpscr",NULL, 4, 0, eEncodingUint, eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, 58, 58 }, NULL, NULL}, 704 { "d16", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d16, LLDB_INVALID_REGNUM, 59, 59 }, NULL, NULL}, 705 { "d17", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d17, LLDB_INVALID_REGNUM, 60, 60 }, NULL, NULL}, 706 { "d18", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d18, LLDB_INVALID_REGNUM, 61, 61 }, NULL, NULL}, 707 { "d19", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d19, LLDB_INVALID_REGNUM, 62, 62 }, NULL, NULL}, 708 { "d20", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d20, LLDB_INVALID_REGNUM, 63, 63 }, NULL, NULL}, 709 { "d21", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d21, LLDB_INVALID_REGNUM, 64, 64 }, NULL, NULL}, 710 { "d22", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d22, LLDB_INVALID_REGNUM, 65, 65 }, NULL, NULL}, 711 { "d23", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d23, LLDB_INVALID_REGNUM, 66, 66 }, NULL, NULL}, 712 { "d24", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d24, LLDB_INVALID_REGNUM, 67, 67 }, NULL, NULL}, 713 { "d25", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d25, LLDB_INVALID_REGNUM, 68, 68 }, NULL, NULL}, 714 { "d26", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d26, LLDB_INVALID_REGNUM, 69, 69 }, NULL, NULL}, 715 { "d27", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d27, LLDB_INVALID_REGNUM, 70, 70 }, NULL, NULL}, 716 { "d28", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d28, LLDB_INVALID_REGNUM, 71, 71 }, NULL, NULL}, 717 { "d29", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d29, LLDB_INVALID_REGNUM, 72, 72 }, NULL, NULL}, 718 { "d30", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d30, LLDB_INVALID_REGNUM, 73, 73 }, NULL, NULL}, 719 { "d31", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d31, LLDB_INVALID_REGNUM, 74, 74 }, NULL, NULL}, 720 { "d0", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d0, LLDB_INVALID_REGNUM, 75, 75 }, g_d0_regs, NULL}, 721 { "d1", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d1, LLDB_INVALID_REGNUM, 76, 76 }, g_d1_regs, NULL}, 722 { "d2", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d2, LLDB_INVALID_REGNUM, 77, 77 }, g_d2_regs, NULL}, 723 { "d3", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d3, LLDB_INVALID_REGNUM, 78, 78 }, g_d3_regs, NULL}, 724 { "d4", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d4, LLDB_INVALID_REGNUM, 79, 79 }, g_d4_regs, NULL}, 725 { "d5", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d5, LLDB_INVALID_REGNUM, 80, 80 }, g_d5_regs, NULL}, 726 { "d6", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d6, LLDB_INVALID_REGNUM, 81, 81 }, g_d6_regs, NULL}, 727 { "d7", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d7, LLDB_INVALID_REGNUM, 82, 82 }, g_d7_regs, NULL}, 728 { "d8", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d8, LLDB_INVALID_REGNUM, 83, 83 }, g_d8_regs, NULL}, 729 { "d9", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d9, LLDB_INVALID_REGNUM, 84, 84 }, g_d9_regs, NULL}, 730 { "d10", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d10, LLDB_INVALID_REGNUM, 85, 85 }, g_d10_regs, NULL}, 731 { "d11", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d11, LLDB_INVALID_REGNUM, 86, 86 }, g_d11_regs, NULL}, 732 { "d12", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d12, LLDB_INVALID_REGNUM, 87, 87 }, g_d12_regs, NULL}, 733 { "d13", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d13, LLDB_INVALID_REGNUM, 88, 88 }, g_d13_regs, NULL}, 734 { "d14", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d14, LLDB_INVALID_REGNUM, 89, 89 }, g_d14_regs, NULL}, 735 { "d15", NULL, 8, 0, eEncodingIEEE754, eFormatFloat, { LLDB_INVALID_REGNUM, dwarf_d15, LLDB_INVALID_REGNUM, 90, 90 }, g_d15_regs, NULL}, 736 { "q0", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q0, LLDB_INVALID_REGNUM, 91, 91 }, g_q0_regs, NULL}, 737 { "q1", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q1, LLDB_INVALID_REGNUM, 92, 92 }, g_q1_regs, NULL}, 738 { "q2", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q2, LLDB_INVALID_REGNUM, 93, 93 }, g_q2_regs, NULL}, 739 { "q3", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q3, LLDB_INVALID_REGNUM, 94, 94 }, g_q3_regs, NULL}, 740 { "q4", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q4, LLDB_INVALID_REGNUM, 95, 95 }, g_q4_regs, NULL}, 741 { "q5", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q5, LLDB_INVALID_REGNUM, 96, 96 }, g_q5_regs, NULL}, 742 { "q6", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q6, LLDB_INVALID_REGNUM, 97, 97 }, g_q6_regs, NULL}, 743 { "q7", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q7, LLDB_INVALID_REGNUM, 98, 98 }, g_q7_regs, NULL}, 744 { "q8", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q8, LLDB_INVALID_REGNUM, 99, 99 }, g_q8_regs, NULL}, 745 { "q9", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q9, LLDB_INVALID_REGNUM, 100, 100 }, g_q9_regs, NULL}, 746 { "q10", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q10, LLDB_INVALID_REGNUM, 101, 101 }, g_q10_regs, NULL}, 747 { "q11", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q11, LLDB_INVALID_REGNUM, 102, 102 }, g_q11_regs, NULL}, 748 { "q12", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q12, LLDB_INVALID_REGNUM, 103, 103 }, g_q12_regs, NULL}, 749 { "q13", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q13, LLDB_INVALID_REGNUM, 104, 104 }, g_q13_regs, NULL}, 750 { "q14", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q14, LLDB_INVALID_REGNUM, 105, 105 }, g_q14_regs, NULL}, 751 { "q15", NULL, 16, 0, eEncodingVector, eFormatVectorOfUInt8, { LLDB_INVALID_REGNUM, dwarf_q15, LLDB_INVALID_REGNUM, 106, 106 }, g_q15_regs, NULL} 752 }; 753 754 static const uint32_t num_registers = sizeof (g_register_infos)/sizeof (RegisterInfo); 755 static ConstString gpr_reg_set ("General Purpose Registers"); 756 static ConstString sfp_reg_set ("Software Floating Point Registers"); 757 static ConstString vfp_reg_set ("Floating Point Registers"); 758 uint32_t i; 759 // Calculate the offsets of the registers 760 // Note that the layout of the "composite" registers (d0-d15 and q0-q15) which comes after the 761 // "primordial" registers is important. This enables us to calculate the offset of the composite 762 // register by using the offset of its first primordial register. For example, to calculate the 763 // offset of q0, use s0's offset. 764 if (g_register_infos[2].byte_offset == 0) 765 { 766 uint32_t byte_offset = 0; 767 for (i=0; i<num_registers; ++i) 768 { 769 // For primordial registers, increment the byte_offset by the byte_size to arrive at the 770 // byte_offset for the next register. Otherwise, we have a composite register whose 771 // offset can be calculated by consulting the offset of its first primordial register. 772 if (!g_register_infos[i].value_regs) 773 { 774 g_register_infos[i].byte_offset = byte_offset; 775 byte_offset += g_register_infos[i].byte_size; 776 } 777 else 778 { 779 const uint32_t first_primordial_reg = g_register_infos[i].value_regs[0]; 780 g_register_infos[i].byte_offset = g_register_infos[first_primordial_reg].byte_offset; 781 } 782 } 783 } 784 for (i=0; i<num_registers; ++i) 785 { 786 ConstString name; 787 ConstString alt_name; 788 if (g_register_infos[i].name && g_register_infos[i].name[0]) 789 name.SetCString(g_register_infos[i].name); 790 if (g_register_infos[i].alt_name && g_register_infos[i].alt_name[0]) 791 alt_name.SetCString(g_register_infos[i].alt_name); 792 793 if (i <= 15 || i == 25) 794 AddRegister (g_register_infos[i], name, alt_name, gpr_reg_set); 795 else if (i <= 24) 796 AddRegister (g_register_infos[i], name, alt_name, sfp_reg_set); 797 else 798 AddRegister (g_register_infos[i], name, alt_name, vfp_reg_set); 799 } 800} 801 802