LLDB  mainline
ABISysV_ppc64.cpp
Go to the documentation of this file.
1 //===-- ABISysV_ppc64.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "ABISysV_ppc64.h"
10 
11 #include "llvm/ADT/STLExtras.h"
12 #include "llvm/ADT/Triple.h"
13 
17 #include "lldb/Core/Module.h"
19 #include "lldb/Core/Value.h"
23 #include "lldb/Symbol/UnwindPlan.h"
24 #include "lldb/Target/Process.h"
26 #include "lldb/Target/StackFrame.h"
27 #include "lldb/Target/Target.h"
28 #include "lldb/Target/Thread.h"
31 #include "lldb/Utility/LLDBLog.h"
32 #include "lldb/Utility/Log.h"
34 #include "lldb/Utility/Status.h"
35 
36 #include "clang/AST/ASTContext.h"
37 #include "clang/AST/Attr.h"
38 #include "clang/AST/Decl.h"
39 
40 #define DECLARE_REGISTER_INFOS_PPC64_STRUCT
42 #undef DECLARE_REGISTER_INFOS_PPC64_STRUCT
43 
44 #define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
46 #undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT
47 
48 using namespace lldb;
49 using namespace lldb_private;
50 
52 
53 const lldb_private::RegisterInfo *
55  if (GetByteOrder() == lldb::eByteOrderLittle) {
56  count = std::size(g_register_infos_ppc64le);
57  return g_register_infos_ppc64le;
58  } else {
59  count = std::size(g_register_infos_ppc64);
60  return g_register_infos_ppc64;
61  }
62 }
63 
64 size_t ABISysV_ppc64::GetRedZoneSize() const { return 224; }
65 
67  return GetProcessSP()->GetByteOrder();
68 }
69 
70 // Static Functions
71 
72 ABISP
73 ABISysV_ppc64::CreateInstance(lldb::ProcessSP process_sp,
74  const ArchSpec &arch) {
75  if (arch.GetTriple().isPPC64())
76  return ABISP(
77  new ABISysV_ppc64(std::move(process_sp), MakeMCRegisterInfo(arch)));
78  return ABISP();
79 }
80 
82  addr_t func_addr, addr_t return_addr,
83  llvm::ArrayRef<addr_t> args) const {
84  Log *log = GetLog(LLDBLog::Expressions);
85 
86  if (log) {
87  StreamString s;
88  s.Printf("ABISysV_ppc64::PrepareTrivialCall (tid = 0x%" PRIx64
89  ", sp = 0x%" PRIx64 ", func_addr = 0x%" PRIx64
90  ", return_addr = 0x%" PRIx64,
91  thread.GetID(), (uint64_t)sp, (uint64_t)func_addr,
92  (uint64_t)return_addr);
93 
94  for (size_t i = 0; i < args.size(); ++i)
95  s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
96  args[i]);
97  s.PutCString(")");
98  log->PutString(s.GetString());
99  }
100 
101  RegisterContext *reg_ctx = thread.GetRegisterContext().get();
102  if (!reg_ctx)
103  return false;
104 
105  const RegisterInfo *reg_info = nullptr;
106 
107  if (args.size() > 8) // TODO handle more than 8 arguments
108  return false;
109 
110  for (size_t i = 0; i < args.size(); ++i) {
111  reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric,
113  LLDB_LOGF(log, "About to write arg%" PRIu64 " (0x%" PRIx64 ") into %s",
114  static_cast<uint64_t>(i + 1), args[i], reg_info->name);
115  if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
116  return false;
117  }
118 
119  // First, align the SP
120 
121  LLDB_LOGF(log, "16-byte aligning SP: 0x%" PRIx64 " to 0x%" PRIx64,
122  (uint64_t)sp, (uint64_t)(sp & ~0xfull));
123 
124  sp &= ~(0xfull); // 16-byte alignment
125 
126  sp -= 544; // allocate frame to save TOC, RA and SP.
127 
128  Status error;
129  uint64_t reg_value;
130  const RegisterInfo *pc_reg_info =
132  const RegisterInfo *sp_reg_info =
134  ProcessSP process_sp(thread.GetProcess());
135  const RegisterInfo *lr_reg_info =
137  const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoAtIndex(2);
138  const RegisterInfo *r12_reg_info = reg_ctx->GetRegisterInfoAtIndex(12);
139 
140  // Save return address onto the stack.
141  LLDB_LOGF(log,
142  "Pushing the return address onto the stack: 0x%" PRIx64
143  "(+16): 0x%" PRIx64,
144  (uint64_t)sp, (uint64_t)return_addr);
145  if (!process_sp->WritePointerToMemory(sp + 16, return_addr, error))
146  return false;
147 
148  // Write the return address to link register.
149  LLDB_LOGF(log, "Writing LR: 0x%" PRIx64, (uint64_t)return_addr);
150  if (!reg_ctx->WriteRegisterFromUnsigned(lr_reg_info, return_addr))
151  return false;
152 
153  // Write target address to %r12 register.
154  LLDB_LOGF(log, "Writing R12: 0x%" PRIx64, (uint64_t)func_addr);
155  if (!reg_ctx->WriteRegisterFromUnsigned(r12_reg_info, func_addr))
156  return false;
157 
158  // Read TOC pointer value.
159  reg_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 0);
160 
161  // Write TOC pointer onto the stack.
162  uint64_t stack_offset;
163  if (GetByteOrder() == lldb::eByteOrderLittle)
164  stack_offset = 24;
165  else
166  stack_offset = 40;
167 
168  LLDB_LOGF(log, "Writing R2 (TOC) at SP(0x%" PRIx64 ")+%d: 0x%" PRIx64,
169  (uint64_t)(sp + stack_offset), (int)stack_offset,
170  (uint64_t)reg_value);
171  if (!process_sp->WritePointerToMemory(sp + stack_offset, reg_value, error))
172  return false;
173 
174  // Read the current SP value.
175  reg_value = reg_ctx->ReadRegisterAsUnsigned(sp_reg_info, 0);
176 
177  // Save current SP onto the stack.
178  LLDB_LOGF(log, "Writing SP at SP(0x%" PRIx64 ")+0: 0x%" PRIx64, (uint64_t)sp,
179  (uint64_t)reg_value);
180  if (!process_sp->WritePointerToMemory(sp, reg_value, error))
181  return false;
182 
183  // %r1 is set to the actual stack value.
184  LLDB_LOGF(log, "Writing SP: 0x%" PRIx64, (uint64_t)sp);
185 
186  if (!reg_ctx->WriteRegisterFromUnsigned(sp_reg_info, sp))
187  return false;
188 
189  // %pc is set to the address of the called function.
190 
191  LLDB_LOGF(log, "Writing IP: 0x%" PRIx64, (uint64_t)func_addr);
192 
193  if (!reg_ctx->WriteRegisterFromUnsigned(pc_reg_info, func_addr))
194  return false;
195 
196  return true;
197 }
198 
199 static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width,
200  bool is_signed, Thread &thread,
201  uint32_t *argument_register_ids,
202  unsigned int &current_argument_register,
203  addr_t &current_stack_argument) {
204  if (bit_width > 64)
205  return false; // Scalar can't hold large integer arguments
206 
207  if (current_argument_register < 6) {
208  scalar = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
209  argument_register_ids[current_argument_register], 0);
210  current_argument_register++;
211  if (is_signed)
212  scalar.SignExtend(bit_width);
213  } else {
214  uint32_t byte_size = (bit_width + (8 - 1)) / 8;
215  Status error;
216  if (thread.GetProcess()->ReadScalarIntegerFromMemory(
217  current_stack_argument, byte_size, is_signed, scalar, error)) {
218  current_stack_argument += byte_size;
219  return true;
220  }
221  return false;
222  }
223  return true;
224 }
225 
226 bool ABISysV_ppc64::GetArgumentValues(Thread &thread, ValueList &values) const {
227  unsigned int num_values = values.GetSize();
228  unsigned int value_index;
229 
230  // Extract the register context so we can read arguments from registers
231 
232  RegisterContext *reg_ctx = thread.GetRegisterContext().get();
233 
234  if (!reg_ctx)
235  return false;
236 
237  // Get the pointer to the first stack argument so we have a place to start
238  // when reading data
239 
240  addr_t sp = reg_ctx->GetSP(0);
241 
242  if (!sp)
243  return false;
244 
245  uint64_t stack_offset;
246  if (GetByteOrder() == lldb::eByteOrderLittle)
247  stack_offset = 32;
248  else
249  stack_offset = 48;
250 
251  // jump over return address.
252  addr_t current_stack_argument = sp + stack_offset;
253  uint32_t argument_register_ids[8];
254 
255  for (size_t i = 0; i < 8; ++i) {
256  argument_register_ids[i] =
257  reg_ctx
260  ->kinds[eRegisterKindLLDB];
261  }
262 
263  unsigned int current_argument_register = 0;
264 
265  for (value_index = 0; value_index < num_values; ++value_index) {
266  Value *value = values.GetValueAtIndex(value_index);
267 
268  if (!value)
269  return false;
270 
271  // We currently only support extracting values with Clang QualTypes. Do we
272  // care about others?
273  CompilerType compiler_type = value->GetCompilerType();
274  llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread);
275  if (!bit_size)
276  return false;
277  bool is_signed;
278 
279  if (compiler_type.IsIntegerOrEnumerationType(is_signed)) {
280  ReadIntegerArgument(value->GetScalar(), *bit_size, is_signed, thread,
281  argument_register_ids, current_argument_register,
282  current_stack_argument);
283  } else if (compiler_type.IsPointerType()) {
284  ReadIntegerArgument(value->GetScalar(), *bit_size, false, thread,
285  argument_register_ids, current_argument_register,
286  current_stack_argument);
287  }
288  }
289 
290  return true;
291 }
292 
293 Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
294  lldb::ValueObjectSP &new_value_sp) {
295  Status error;
296  if (!new_value_sp) {
297  error.SetErrorString("Empty value object for return value.");
298  return error;
299  }
300 
301  CompilerType compiler_type = new_value_sp->GetCompilerType();
302  if (!compiler_type) {
303  error.SetErrorString("Null clang type for return value.");
304  return error;
305  }
306 
307  Thread *thread = frame_sp->GetThread().get();
308 
309  bool is_signed;
310  uint32_t count;
311  bool is_complex;
312 
313  RegisterContext *reg_ctx = thread->GetRegisterContext().get();
314 
315  bool set_it_simple = false;
316  if (compiler_type.IsIntegerOrEnumerationType(is_signed) ||
317  compiler_type.IsPointerType()) {
318  const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("r3", 0);
319 
320  DataExtractor data;
321  Status data_error;
322  size_t num_bytes = new_value_sp->GetData(data, data_error);
323  if (data_error.Fail()) {
324  error.SetErrorStringWithFormat(
325  "Couldn't convert return value to raw data: %s",
326  data_error.AsCString());
327  return error;
328  }
329  lldb::offset_t offset = 0;
330  if (num_bytes <= 8) {
331  uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
332 
333  if (reg_ctx->WriteRegisterFromUnsigned(reg_info, raw_value))
334  set_it_simple = true;
335  } else {
336  error.SetErrorString("We don't support returning longer than 64 bit "
337  "integer values at present.");
338  }
339  } else if (compiler_type.IsFloatingPointType(count, is_complex)) {
340  if (is_complex)
341  error.SetErrorString(
342  "We don't support returning complex values at present");
343  else {
344  llvm::Optional<uint64_t> bit_width =
345  compiler_type.GetBitSize(frame_sp.get());
346  if (!bit_width) {
347  error.SetErrorString("can't get size of type");
348  return error;
349  }
350  if (*bit_width <= 64) {
351  DataExtractor data;
352  Status data_error;
353  size_t num_bytes = new_value_sp->GetData(data, data_error);
354  if (data_error.Fail()) {
355  error.SetErrorStringWithFormat(
356  "Couldn't convert return value to raw data: %s",
357  data_error.AsCString());
358  return error;
359  }
360 
361  unsigned char buffer[16];
362  ByteOrder byte_order = data.GetByteOrder();
363 
364  data.CopyByteOrderedData(0, num_bytes, buffer, 16, byte_order);
365  set_it_simple = true;
366  } else {
367  // FIXME - don't know how to do 80 bit long doubles yet.
368  error.SetErrorString(
369  "We don't support returning float values > 64 bits at present");
370  }
371  }
372  }
373 
374  if (!set_it_simple) {
375  // Okay we've got a structure or something that doesn't fit in a simple
376  // register. We should figure out where it really goes, but we don't
377  // support this yet.
378  error.SetErrorString("We only support setting simple integer and float "
379  "return types at present.");
380  }
381 
382  return error;
383 }
384 
385 //
386 // ReturnValueExtractor
387 //
388 
389 namespace {
390 
391 #define LOG_PREFIX "ReturnValueExtractor: "
392 
393 class ReturnValueExtractor {
394  // This class represents a register, from which data may be extracted.
395  //
396  // It may be constructed by directly specifying its index (where 0 is the
397  // first register used to return values) or by specifying the offset of a
398  // given struct field, in which case the appropriated register index will be
399  // calculated.
400  class Register {
401  public:
402  enum Type {
403  GPR, // General Purpose Register
404  FPR // Floating Point Register
405  };
406 
407  // main constructor
408  //
409  // offs - field offset in struct
410  Register(Type ty, uint32_t index, uint32_t offs, RegisterContext *reg_ctx,
411  ByteOrder byte_order)
412  : m_index(index), m_offs(offs % sizeof(uint64_t)),
413  m_avail(sizeof(uint64_t) - m_offs), m_type(ty), m_reg_ctx(reg_ctx),
414  m_byte_order(byte_order) {}
415 
416  // explicit index, no offset
417  Register(Type ty, uint32_t index, RegisterContext *reg_ctx,
418  ByteOrder byte_order)
419  : Register(ty, index, 0, reg_ctx, byte_order) {}
420 
421  // GPR, calculate index from offs
422  Register(uint32_t offs, RegisterContext *reg_ctx, ByteOrder byte_order)
423  : Register(GPR, offs / sizeof(uint64_t), offs, reg_ctx, byte_order) {}
424 
425  uint32_t Index() const { return m_index; }
426 
427  // register offset where data is located
428  uint32_t Offs() const { return m_offs; }
429 
430  // available bytes in this register
431  uint32_t Avail() const { return m_avail; }
432 
433  bool IsValid() const {
434  if (m_index > 7) {
435  LLDB_LOG(m_log, LOG_PREFIX
436  "No more than 8 registers should be used to return values");
437  return false;
438  }
439  return true;
440  }
441 
442  std::string GetName() const {
443  if (m_type == GPR)
444  return ("r" + llvm::Twine(m_index + 3)).str();
445  else
446  return ("f" + llvm::Twine(m_index + 1)).str();
447  }
448 
449  // get raw register data
450  bool GetRawData(uint64_t &raw_data) {
451  const RegisterInfo *reg_info =
452  m_reg_ctx->GetRegisterInfoByName(GetName());
453  if (!reg_info) {
454  LLDB_LOG(m_log, LOG_PREFIX "Failed to get RegisterInfo");
455  return false;
456  }
457 
458  RegisterValue reg_val;
459  if (!m_reg_ctx->ReadRegister(reg_info, reg_val)) {
460  LLDB_LOG(m_log, LOG_PREFIX "ReadRegister() failed");
461  return false;
462  }
463 
464  Status error;
465  uint32_t rc = reg_val.GetAsMemoryData(
466  *reg_info, &raw_data, sizeof(raw_data), m_byte_order, error);
467  if (rc != sizeof(raw_data)) {
468  LLDB_LOG(m_log, LOG_PREFIX "GetAsMemoryData() failed");
469  return false;
470  }
471 
472  return true;
473  }
474 
475  private:
476  uint32_t m_index;
477  uint32_t m_offs;
478  uint32_t m_avail;
479  Type m_type;
480  RegisterContext *m_reg_ctx;
481  ByteOrder m_byte_order;
482  Log *m_log = GetLog(LLDBLog::Expressions);
483  };
484 
485  Register GetGPR(uint32_t index) const {
486  return Register(Register::GPR, index, m_reg_ctx, m_byte_order);
487  }
488 
489  Register GetFPR(uint32_t index) const {
490  return Register(Register::FPR, index, m_reg_ctx, m_byte_order);
491  }
492 
493  Register GetGPRByOffs(uint32_t offs) const {
494  return Register(offs, m_reg_ctx, m_byte_order);
495  }
496 
497 public:
498  // factory
499  static llvm::Expected<ReturnValueExtractor> Create(Thread &thread,
500  CompilerType &type) {
501  RegisterContext *reg_ctx = thread.GetRegisterContext().get();
502  if (!reg_ctx)
503  return llvm::make_error<llvm::StringError>(
504  LOG_PREFIX "Failed to get RegisterContext",
505  llvm::inconvertibleErrorCode());
506 
507  ProcessSP process_sp = thread.GetProcess();
508  if (!process_sp)
509  return llvm::make_error<llvm::StringError>(
510  LOG_PREFIX "GetProcess() failed", llvm::inconvertibleErrorCode());
511 
512  return ReturnValueExtractor(thread, type, reg_ctx, process_sp);
513  }
514 
515  // main method: get value of the type specified at construction time
516  ValueObjectSP GetValue() {
517  const uint32_t type_flags = m_type.GetTypeInfo();
518 
519  // call the appropriate type handler
520  ValueSP value_sp;
521  ValueObjectSP valobj_sp;
522  if (type_flags & eTypeIsScalar) {
523  if (type_flags & eTypeIsInteger) {
524  value_sp = GetIntegerValue(0);
525  } else if (type_flags & eTypeIsFloat) {
526  if (type_flags & eTypeIsComplex) {
527  LLDB_LOG(m_log, LOG_PREFIX "Complex numbers are not supported yet");
528  return ValueObjectSP();
529  } else {
530  value_sp = GetFloatValue(m_type, 0);
531  }
532  }
533  } else if (type_flags & eTypeIsPointer) {
534  value_sp = GetPointerValue(0);
535  }
536 
537  if (value_sp) {
538  valobj_sp = ValueObjectConstResult::Create(
539  m_thread.GetStackFrameAtIndex(0).get(), *value_sp, ConstString(""));
540  } else if (type_flags & eTypeIsVector) {
541  valobj_sp = GetVectorValueObject();
542  } else if (type_flags & eTypeIsStructUnion || type_flags & eTypeIsClass) {
543  valobj_sp = GetStructValueObject();
544  }
545 
546  return valobj_sp;
547  }
548 
549 private:
550  // data
551  Thread &m_thread;
552  CompilerType &m_type;
553  uint64_t m_byte_size;
554  std::unique_ptr<DataBufferHeap> m_data_up;
555  int32_t m_src_offs = 0;
556  int32_t m_dst_offs = 0;
557  bool m_packed = false;
558  Log *m_log = GetLog(LLDBLog::Expressions);
559  RegisterContext *m_reg_ctx;
560  ProcessSP m_process_sp;
561  ByteOrder m_byte_order;
562  uint32_t m_addr_size;
563 
564  // methods
565 
566  // constructor
567  ReturnValueExtractor(Thread &thread, CompilerType &type,
568  RegisterContext *reg_ctx, ProcessSP process_sp)
569  : m_thread(thread), m_type(type),
570  m_byte_size(m_type.GetByteSize(&thread).value_or(0)),
571  m_data_up(new DataBufferHeap(m_byte_size, 0)), m_reg_ctx(reg_ctx),
572  m_process_sp(process_sp), m_byte_order(process_sp->GetByteOrder()),
573  m_addr_size(
574  process_sp->GetTarget().GetArchitecture().GetAddressByteSize()) {}
575 
576  // build a new scalar value
577  ValueSP NewScalarValue(CompilerType &type) {
578  ValueSP value_sp(new Value);
579  value_sp->SetCompilerType(type);
580  value_sp->SetValueType(Value::ValueType::Scalar);
581  return value_sp;
582  }
583 
584  // get an integer value in the specified register
585  ValueSP GetIntegerValue(uint32_t reg_index) {
586  uint64_t raw_value;
587  auto reg = GetGPR(reg_index);
588  if (!reg.GetRawData(raw_value))
589  return ValueSP();
590 
591  // build value from data
592  ValueSP value_sp(NewScalarValue(m_type));
593 
594  uint32_t type_flags = m_type.GetTypeInfo();
595  bool is_signed = (type_flags & eTypeIsSigned) != 0;
596 
597  switch (m_byte_size) {
598  case sizeof(uint64_t):
599  if (is_signed)
600  value_sp->GetScalar() = (int64_t)(raw_value);
601  else
602  value_sp->GetScalar() = (uint64_t)(raw_value);
603  break;
604 
605  case sizeof(uint32_t):
606  if (is_signed)
607  value_sp->GetScalar() = (int32_t)(raw_value & UINT32_MAX);
608  else
609  value_sp->GetScalar() = (uint32_t)(raw_value & UINT32_MAX);
610  break;
611 
612  case sizeof(uint16_t):
613  if (is_signed)
614  value_sp->GetScalar() = (int16_t)(raw_value & UINT16_MAX);
615  else
616  value_sp->GetScalar() = (uint16_t)(raw_value & UINT16_MAX);
617  break;
618 
619  case sizeof(uint8_t):
620  if (is_signed)
621  value_sp->GetScalar() = (int8_t)(raw_value & UINT8_MAX);
622  else
623  value_sp->GetScalar() = (uint8_t)(raw_value & UINT8_MAX);
624  break;
625 
626  default:
627  llvm_unreachable("Invalid integer size");
628  }
629 
630  return value_sp;
631  }
632 
633  // get a floating point value on the specified register
634  ValueSP GetFloatValue(CompilerType &type, uint32_t reg_index) {
635  uint64_t raw_data;
636  auto reg = GetFPR(reg_index);
637  if (!reg.GetRawData(raw_data))
638  return {};
639 
640  // build value from data
641  ValueSP value_sp(NewScalarValue(type));
642 
643  DataExtractor de(&raw_data, sizeof(raw_data), m_byte_order, m_addr_size);
644 
645  offset_t offset = 0;
646  llvm::Optional<uint64_t> byte_size = type.GetByteSize(m_process_sp.get());
647  if (!byte_size)
648  return {};
649  switch (*byte_size) {
650  case sizeof(float):
651  value_sp->GetScalar() = (float)de.GetDouble(&offset);
652  break;
653 
654  case sizeof(double):
655  value_sp->GetScalar() = de.GetDouble(&offset);
656  break;
657 
658  default:
659  llvm_unreachable("Invalid floating point size");
660  }
661 
662  return value_sp;
663  }
664 
665  // get pointer value from register
666  ValueSP GetPointerValue(uint32_t reg_index) {
667  uint64_t raw_data;
668  auto reg = GetGPR(reg_index);
669  if (!reg.GetRawData(raw_data))
670  return ValueSP();
671 
672  // build value from raw data
673  ValueSP value_sp(NewScalarValue(m_type));
674  value_sp->GetScalar() = raw_data;
675  return value_sp;
676  }
677 
678  // build the ValueObject from our data buffer
679  ValueObjectSP BuildValueObject() {
680  DataExtractor de(DataBufferSP(m_data_up.release()), m_byte_order,
681  m_addr_size);
682  return ValueObjectConstResult::Create(&m_thread, m_type, ConstString(""),
683  de);
684  }
685 
686  // get a vector return value
687  ValueObjectSP GetVectorValueObject() {
688  const uint32_t MAX_VRS = 2;
689 
690  // get first V register used to return values
691  const RegisterInfo *vr[MAX_VRS];
692  vr[0] = m_reg_ctx->GetRegisterInfoByName("vr2");
693  if (!vr[0]) {
694  LLDB_LOG(m_log, LOG_PREFIX "Failed to get vr2 RegisterInfo");
695  return ValueObjectSP();
696  }
697 
698  const uint32_t vr_size = vr[0]->byte_size;
699  size_t vrs = 1;
700  if (m_byte_size > 2 * vr_size) {
701  LLDB_LOG(
702  m_log, LOG_PREFIX
703  "Returning vectors that don't fit in 2 VR regs is not supported");
704  return ValueObjectSP();
705  }
706 
707  // load vr3, if needed
708  if (m_byte_size > vr_size) {
709  vrs++;
710  vr[1] = m_reg_ctx->GetRegisterInfoByName("vr3");
711  if (!vr[1]) {
712  LLDB_LOG(m_log, LOG_PREFIX "Failed to get vr3 RegisterInfo");
713  return ValueObjectSP();
714  }
715  }
716 
717  // Get the whole contents of vector registers and let the logic here
718  // arrange the data properly.
719 
720  RegisterValue vr_val[MAX_VRS];
721  Status error;
722  std::unique_ptr<DataBufferHeap> vr_data(
723  new DataBufferHeap(vrs * vr_size, 0));
724 
725  for (uint32_t i = 0; i < vrs; i++) {
726  if (!m_reg_ctx->ReadRegister(vr[i], vr_val[i])) {
727  LLDB_LOG(m_log, LOG_PREFIX "Failed to read vector register contents");
728  return ValueObjectSP();
729  }
730  if (!vr_val[i].GetAsMemoryData(*vr[i], vr_data->GetBytes() + i * vr_size,
731  vr_size, m_byte_order, error)) {
732  LLDB_LOG(m_log, LOG_PREFIX "Failed to extract vector register bytes");
733  return ValueObjectSP();
734  }
735  }
736 
737  // The compiler generated code seems to always put the vector elements at
738  // the end of the vector register, in case they don't occupy all of it.
739  // This offset variable handles this.
740  uint32_t offs = 0;
741  if (m_byte_size < vr_size)
742  offs = vr_size - m_byte_size;
743 
744  // copy extracted data to our buffer
745  memcpy(m_data_up->GetBytes(), vr_data->GetBytes() + offs, m_byte_size);
746  return BuildValueObject();
747  }
748 
749  // get a struct return value
750  ValueObjectSP GetStructValueObject() {
751  // case 1: get from stack
752  if (m_byte_size > 2 * sizeof(uint64_t)) {
753  uint64_t addr;
754  auto reg = GetGPR(0);
755  if (!reg.GetRawData(addr))
756  return {};
757 
758  Status error;
759  size_t rc = m_process_sp->ReadMemory(addr, m_data_up->GetBytes(),
760  m_byte_size, error);
761  if (rc != m_byte_size) {
762  LLDB_LOG(m_log, LOG_PREFIX "Failed to read memory pointed by r3");
763  return ValueObjectSP();
764  }
765  return BuildValueObject();
766  }
767 
768  // get number of children
769  const bool omit_empty_base_classes = true;
770  uint32_t n = m_type.GetNumChildren(omit_empty_base_classes, nullptr);
771  if (!n) {
772  LLDB_LOG(m_log, LOG_PREFIX "No children found in struct");
773  return {};
774  }
775 
776  // case 2: homogeneous double or float aggregate
777  CompilerType elem_type;
778  if (m_type.IsHomogeneousAggregate(&elem_type)) {
779  uint32_t type_flags = elem_type.GetTypeInfo();
780  llvm::Optional<uint64_t> elem_size =
781  elem_type.GetByteSize(m_process_sp.get());
782  if (!elem_size)
783  return {};
784  if (type_flags & eTypeIsComplex || !(type_flags & eTypeIsFloat)) {
785  LLDB_LOG(m_log,
786  LOG_PREFIX "Unexpected type found in homogeneous aggregate");
787  return {};
788  }
789 
790  for (uint32_t i = 0; i < n; i++) {
791  ValueSP val_sp = GetFloatValue(elem_type, i);
792  if (!val_sp)
793  return {};
794 
795  // copy to buffer
796  Status error;
797  size_t rc = val_sp->GetScalar().GetAsMemoryData(
798  m_data_up->GetBytes() + m_dst_offs, *elem_size, m_byte_order,
799  error);
800  if (rc != *elem_size) {
801  LLDB_LOG(m_log, LOG_PREFIX "Failed to get float data");
802  return {};
803  }
804  m_dst_offs += *elem_size;
805  }
806  return BuildValueObject();
807  }
808 
809  // case 3: get from GPRs
810 
811  // first, check if this is a packed struct or not
812  auto ast = m_type.GetTypeSystem().dyn_cast_or_null<TypeSystemClang>();
813  if (ast) {
814  clang::RecordDecl *record_decl = TypeSystemClang::GetAsRecordDecl(m_type);
815 
816  if (record_decl) {
817  auto attrs = record_decl->attrs();
818  for (const auto &attr : attrs) {
819  if (attr->getKind() == clang::attr::Packed) {
820  m_packed = true;
821  break;
822  }
823  }
824  }
825  }
826 
827  LLDB_LOG(m_log, LOG_PREFIX "{0} struct",
828  m_packed ? "packed" : "not packed");
829 
830  for (uint32_t i = 0; i < n; i++) {
831  std::string name;
832  uint32_t size;
833  GetChildType(i, name, size);
834  // NOTE: the offset returned by GetChildCompilerTypeAtIndex()
835  // can't be used because it never considers alignment bytes
836  // between struct fields.
837  LLDB_LOG(m_log, LOG_PREFIX "field={0}, size={1}", name, size);
838  if (!ExtractField(size))
839  return ValueObjectSP();
840  }
841 
842  return BuildValueObject();
843  }
844 
845  // extract 'size' bytes at 'offs' from GPRs
846  bool ExtractFromRegs(int32_t offs, uint32_t size, void *buf) {
847  while (size) {
848  auto reg = GetGPRByOffs(offs);
849  if (!reg.IsValid())
850  return false;
851 
852  uint32_t n = std::min(reg.Avail(), size);
853  uint64_t raw_data;
854 
855  if (!reg.GetRawData(raw_data))
856  return false;
857 
858  memcpy(buf, (char *)&raw_data + reg.Offs(), n);
859  offs += n;
860  size -= n;
861  buf = (char *)buf + n;
862  }
863  return true;
864  }
865 
866  // extract one field from GPRs and put it in our buffer
867  bool ExtractField(uint32_t size) {
868  auto reg = GetGPRByOffs(m_src_offs);
869  if (!reg.IsValid())
870  return false;
871 
872  // handle padding
873  if (!m_packed) {
874  uint32_t n = m_src_offs % size;
875 
876  // not 'size' bytes aligned
877  if (n) {
878  LLDB_LOG(m_log,
879  LOG_PREFIX "Extracting {0} alignment bytes at offset {1}", n,
880  m_src_offs);
881  // get alignment bytes
882  if (!ExtractFromRegs(m_src_offs, n, m_data_up->GetBytes() + m_dst_offs))
883  return false;
884  m_src_offs += n;
885  m_dst_offs += n;
886  }
887  }
888 
889  // get field
890  LLDB_LOG(m_log, LOG_PREFIX "Extracting {0} field bytes at offset {1}", size,
891  m_src_offs);
892  if (!ExtractFromRegs(m_src_offs, size, m_data_up->GetBytes() + m_dst_offs))
893  return false;
894  m_src_offs += size;
895  m_dst_offs += size;
896  return true;
897  }
898 
899  // get child
900  CompilerType GetChildType(uint32_t i, std::string &name, uint32_t &size) {
901  // GetChild constant inputs
902  const bool transparent_pointers = false;
903  const bool omit_empty_base_classes = true;
904  const bool ignore_array_bounds = false;
905  // GetChild output params
906  int32_t child_offs;
907  uint32_t child_bitfield_bit_size;
908  uint32_t child_bitfield_bit_offset;
909  bool child_is_base_class;
910  bool child_is_deref_of_parent;
911  ValueObject *valobj = nullptr;
912  uint64_t language_flags;
913  ExecutionContext exe_ctx;
914  m_thread.CalculateExecutionContext(exe_ctx);
915 
916  return m_type.GetChildCompilerTypeAtIndex(
917  &exe_ctx, i, transparent_pointers, omit_empty_base_classes,
918  ignore_array_bounds, name, size, child_offs, child_bitfield_bit_size,
919  child_bitfield_bit_offset, child_is_base_class,
920  child_is_deref_of_parent, valobj, language_flags);
921  }
922 };
923 
924 #undef LOG_PREFIX
925 
926 } // anonymous namespace
927 
928 ValueObjectSP
930  CompilerType &type) const {
931  if (!type)
932  return ValueObjectSP();
933 
934  auto exp_extractor = ReturnValueExtractor::Create(thread, type);
935  if (!exp_extractor) {
936  Log *log = GetLog(LLDBLog::Expressions);
937  LLDB_LOG_ERROR(log, exp_extractor.takeError(),
938  "Extracting return value failed: {0}");
939  return ValueObjectSP();
940  }
941 
942  return exp_extractor.get().GetValue();
943 }
944 
946  Thread &thread, CompilerType &return_compiler_type) const {
947  return GetReturnValueObjectSimple(thread, return_compiler_type);
948 }
949 
951  unwind_plan.Clear();
952  unwind_plan.SetRegisterKind(eRegisterKindDWARF);
953 
954  uint32_t lr_reg_num;
955  uint32_t sp_reg_num;
956  uint32_t pc_reg_num;
957 
958  if (GetByteOrder() == lldb::eByteOrderLittle) {
959  lr_reg_num = ppc64le_dwarf::dwarf_lr_ppc64le;
960  sp_reg_num = ppc64le_dwarf::dwarf_r1_ppc64le;
961  pc_reg_num = ppc64le_dwarf::dwarf_pc_ppc64le;
962  } else {
963  lr_reg_num = ppc64_dwarf::dwarf_lr_ppc64;
964  sp_reg_num = ppc64_dwarf::dwarf_r1_ppc64;
965  pc_reg_num = ppc64_dwarf::dwarf_pc_ppc64;
966  }
967 
969 
970  // Our Call Frame Address is the stack pointer value
971  row->GetCFAValue().SetIsRegisterPlusOffset(sp_reg_num, 0);
972 
973  // The previous PC is in the LR
974  row->SetRegisterLocationToRegister(pc_reg_num, lr_reg_num, true);
975  unwind_plan.AppendRow(row);
976 
977  // All other registers are the same.
978 
979  unwind_plan.SetSourceName("ppc64 at-func-entry default");
980  unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
981 
982  return true;
983 }
984 
986  unwind_plan.Clear();
987  unwind_plan.SetRegisterKind(eRegisterKindDWARF);
988 
989  uint32_t sp_reg_num;
990  uint32_t pc_reg_num;
991  uint32_t cr_reg_num;
992 
993  if (GetByteOrder() == lldb::eByteOrderLittle) {
994  sp_reg_num = ppc64le_dwarf::dwarf_r1_ppc64le;
995  pc_reg_num = ppc64le_dwarf::dwarf_lr_ppc64le;
996  cr_reg_num = ppc64le_dwarf::dwarf_cr_ppc64le;
997  } else {
998  sp_reg_num = ppc64_dwarf::dwarf_r1_ppc64;
999  pc_reg_num = ppc64_dwarf::dwarf_lr_ppc64;
1000  cr_reg_num = ppc64_dwarf::dwarf_cr_ppc64;
1001  }
1002 
1004  const int32_t ptr_size = 8;
1005  row->SetUnspecifiedRegistersAreUndefined(true);
1006  row->GetCFAValue().SetIsRegisterDereferenced(sp_reg_num);
1007 
1008  row->SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, ptr_size * 2, true);
1009  row->SetRegisterLocationToIsCFAPlusOffset(sp_reg_num, 0, true);
1010  row->SetRegisterLocationToAtCFAPlusOffset(cr_reg_num, ptr_size, true);
1011 
1012  unwind_plan.AppendRow(row);
1013  unwind_plan.SetSourceName("ppc64 default unwind plan");
1014  unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
1017  unwind_plan.SetReturnAddressRegister(pc_reg_num);
1018  return true;
1019 }
1020 
1021 bool ABISysV_ppc64::RegisterIsVolatile(const RegisterInfo *reg_info) {
1022  return !RegisterIsCalleeSaved(reg_info);
1023 }
1024 
1025 // See "Register Usage" in the
1026 // "System V Application Binary Interface"
1027 // "64-bit PowerPC ELF Application Binary Interface Supplement" current version
1028 // is 2 released 2015 at
1029 // https://members.openpowerfoundation.org/document/dl/576
1030 bool ABISysV_ppc64::RegisterIsCalleeSaved(const RegisterInfo *reg_info) {
1031  if (reg_info) {
1032  // Preserved registers are :
1033  // r1,r2,r13-r31
1034  // cr2-cr4 (partially preserved)
1035  // f14-f31 (not yet)
1036  // v20-v31 (not yet)
1037  // vrsave (not yet)
1038 
1039  const char *name = reg_info->name;
1040  if (name[0] == 'r') {
1041  if ((name[1] == '1' || name[1] == '2') && name[2] == '\0')
1042  return true;
1043  if (name[1] == '1' && name[2] > '2')
1044  return true;
1045  if ((name[1] == '2' || name[1] == '3') && name[2] != '\0')
1046  return true;
1047  }
1048 
1049  if (name[0] == 'f' && name[1] >= '0' && name[2] <= '9') {
1050  if (name[2] == '\0')
1051  return false;
1052  if (name[1] == '1' && name[2] >= '4')
1053  return true;
1054  if ((name[1] == '2' || name[1] == '3') && name[2] != '\0')
1055  return true;
1056  }
1057 
1058  if (name[0] == 's' && name[1] == 'p' && name[2] == '\0') // sp
1059  return true;
1060  if (name[0] == 'f' && name[1] == 'p' && name[2] == '\0') // fp
1061  return false;
1062  if (name[0] == 'p' && name[1] == 'c' && name[2] == '\0') // pc
1063  return true;
1064  }
1065  return false;
1066 }
1067 
1069  PluginManager::RegisterPlugin(
1070  GetPluginNameStatic(), "System V ABI for ppc64 targets", CreateInstance);
1071 }
1072 
1074  PluginManager::UnregisterPlugin(CreateInstance);
1075 }
ABISysV_ppc64::GetRedZoneSize
size_t GetRedZoneSize() const override
Definition: ABISysV_ppc64.cpp:64
ABISysV_ppc64::RegisterIsVolatile
bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override
Definition: ABISysV_ppc64.cpp:1021
ppc64_dwarf::dwarf_r1_ppc64
@ dwarf_r1_ppc64
Definition: PPC64_DWARF_Registers.h:18
PPC64_DWARF_Registers.h
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::UnwindPlan::AppendRow
void AppendRow(const RowSP &row_sp)
Definition: UnwindPlan.cpp:362
lldb_private::ArchSpec
Definition: ArchSpec.h:32
lldb_private::Log::PutString
void PutString(llvm::StringRef str)
Definition: Log.cpp:135
LLDB_REGNUM_GENERIC_ARG1
#define LLDB_REGNUM_GENERIC_ARG1
Definition: lldb-defines.h:56
lldb_private::Scalar::SignExtend
bool SignExtend(uint32_t bit_pos)
Definition: Scalar.cpp:745
lldb_private::RegisterValue
Definition: RegisterValue.h:28
lldb_private::UnwindPlan::SetRegisterKind
void SetRegisterKind(lldb::RegisterKind kind)
Definition: UnwindPlan.h:437
lldb::eRegisterKindDWARF
@ eRegisterKindDWARF
the register numbers seen DWARF
Definition: lldb-enumerations.h:230
lldb_private::Value
Definition: Value.h:38
lldb::eRegisterKindGeneric
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
Definition: lldb-enumerations.h:231
ABISysV_ppc64::PrepareTrivialCall
bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, llvm::ArrayRef< lldb::addr_t > args) const override
Definition: ABISysV_ppc64.cpp:81
lldb_private::ValueList::GetValueAtIndex
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:669
lldb_private::UnwindPlan::SetUnwindPlanValidAtAllInstructions
void SetUnwindPlanValidAtAllInstructions(lldb_private::LazyBool valid_at_all_insn)
Definition: UnwindPlan.h:490
lldb_private::RegisterContext::ReadRegister
virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value)=0
ppc64le_dwarf::dwarf_r1_ppc64le
@ dwarf_r1_ppc64le
Definition: PPC64LE_DWARF_Registers.h:18
lldb_private::Scalar
Definition: Scalar.h:34
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
Module.h
ABISysV_ppc64::CreateInstance
static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch)
Definition: ABISysV_ppc64.cpp:73
ABISysV_ppc64::GetArgumentValues
bool GetArgumentValues(lldb_private::Thread &thread, lldb_private::ValueList &values) const override
Definition: ABISysV_ppc64.cpp:226
lldb_private::RegisterContext::ReadRegisterAsUnsigned
uint64_t ReadRegisterAsUnsigned(uint32_t reg, uint64_t fail_value)
Definition: RegisterContext.cpp:188
lldb_private::CompilerType::GetByteSize
llvm::Optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
Definition: CompilerType.cpp:552
lldb_private::UnwindPlan::SetUnwindPlanForSignalTrap
void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap)
Definition: UnwindPlan.h:502
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
RegisterValue.h
lldb_private::ValueList
Definition: Value.h:157
StackFrame.h
lldb_private::RegisterValue::GetAsMemoryData
uint32_t GetAsMemoryData(const RegisterInfo &reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
Definition: RegisterValue.cpp:38
ValueObjectMemory.h
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:463
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::CompilerType::IsFloatingPointType
bool IsFloatingPointType(uint32_t &count, bool &is_complex) const
Definition: CompilerType.cpp:220
ReadIntegerArgument
static bool ReadIntegerArgument(Scalar &scalar, unsigned int bit_width, bool is_signed, Thread &thread, uint32_t *argument_register_ids, unsigned int &current_argument_register, addr_t &current_stack_argument)
Definition: ABISysV_ppc64.cpp:199
lldb_private::RegisterContext::GetRegisterInfoAtIndex
virtual const RegisterInfo * GetRegisterInfoAtIndex(size_t reg)=0
lldb_private::UnwindPlan::SetSourceName
void SetSourceName(const char *)
Definition: UnwindPlan.cpp:564
lldb_private::ValueList::GetSize
size_t GetSize()
Definition: Value.cpp:667
ABISysV_ppc64::Terminate
static void Terminate()
Definition: ABISysV_ppc64.cpp:1073
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
ABISysV_ppc64::RegisterIsCalleeSaved
bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info)
Definition: ABISysV_ppc64.cpp:1030
Process.h
lldb_private::CompilerType::IsIntegerOrEnumerationType
bool IsIntegerOrEnumerationType(bool &is_signed) const
Definition: CompilerType.cpp:178
ppc64_dwarf::dwarf_cr_ppc64
@ dwarf_cr_ppc64
Definition: PPC64_DWARF_Registers.h:81
Target.h
ppc64le_dwarf::dwarf_pc_ppc64le
@ dwarf_pc_ppc64le
Definition: PPC64LE_DWARF_Registers.h:119
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
lldb_private::CompilerType::IsHomogeneousAggregate
uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const
Definition: CompilerType.cpp:127
lldb_private::Thread::GetProcess
lldb::ProcessSP GetProcess() const
Definition: Thread.h:153
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::CompilerType::GetTypeSystem
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
Definition: CompilerType.cpp:980
ABISysV_ppc64
Definition: ABISysV_ppc64.h:15
lldb::eRegisterKindLLDB
@ eRegisterKindLLDB
lldb's internal register numbers
Definition: lldb-enumerations.h:235
lldb_private::DataExtractor
Definition: DataExtractor.h:48
Log.h
TypeSystemClang.h
lldb_private::UnwindPlan::SetReturnAddressRegister
void SetReturnAddressRegister(uint32_t regnum)
Definition: UnwindPlan.h:439
lldb_private::Thread
Definition: Thread.h:61
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
lldb_private::CompilerType::GetChildCompilerTypeAtIndex
CompilerType GetChildCompilerTypeAtIndex(ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds, std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) const
Definition: CompilerType.cpp:675
GetName
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb_private::DataExtractor::GetDouble
double GetDouble(lldb::offset_t *offset_ptr) const
Definition: DataExtractor.cpp:626
lldb_private::RegisterContext::GetRegisterInfo
const RegisterInfo * GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num)
Definition: RegisterContext.cpp:80
lldb_private::UnwindPlan::SetSourcedFromCompiler
void SetSourcedFromCompiler(lldb_private::LazyBool from_compiler)
Definition: UnwindPlan.h:478
lldb_private::DataExtractor::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Get the current byte order value.
Definition: DataExtractor.h:594
ValueObjectRegister.h
lldb_private::ConstString
Definition: ConstString.h:39
ABISysV_ppc64::GetReturnValueObjectImpl
lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread &thread, lldb_private::CompilerType &type) const override
Definition: ABISysV_ppc64.cpp:945
lldb_private::StreamString
Definition: StreamString.h:23
LOG_PREFIX
#define LOG_PREFIX
Definition: ABISysV_ppc64.cpp:391
ABISysV_ppc64::SetReturnValueObject
lldb_private::Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override
Definition: ABISysV_ppc64.cpp:293
ABISysV_ppc64::CreateDefaultUnwindPlan
bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override
Definition: ABISysV_ppc64.cpp:985
lldb_private::FPR
Definition: RegisterContext_x86.h:363
PPC64LE_DWARF_Registers.h
ABISysV_ppc64.h
ABISysV_ppc64::CreateFunctionEntryUnwindPlan
bool CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override
Definition: ABISysV_ppc64.cpp:950
FPR
struct _FPR FPR
sp
@ sp
Definition: CompactUnwindInfo.cpp:1250
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
Thread.h
UnwindPlan.h
lldb_private::RegisterContext::GetSP
uint64_t GetSP(uint64_t fail_value=LLDB_INVALID_ADDRESS)
Definition: RegisterContext.cpp:152
lldb_private::RegisterContext
Definition: RegisterContext.h:17
RegisterInfos_ppc64.h
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::Thread::CalculateExecutionContext
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
Definition: Thread.cpp:1419
lldb_private::CompilerType::GetNumChildren
uint32_t GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
Definition: CompilerType.cpp:579
ValueObjectConstResult.h
lldb_private::UnwindPlan::RowSP
std::shared_ptr< Row > RowSP
Definition: UnwindPlan.h:395
GPR
Definition: RegisterContextFreeBSD_i386.cpp:16
GPR
#define GPR(r16)
Definition: ABIX86.cpp:144
lldb_private::UnwindPlan::Clear
void Clear()
Definition: UnwindPlan.h:508
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::RegisterContext::WriteRegisterFromUnsigned
bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
Definition: RegisterContext.cpp:205
lldb_private::UnwindPlan::Row
Definition: UnwindPlan.h:55
uint32_t
lldb_private::eLazyBoolNo
@ eLazyBoolNo
Definition: lldb-private-enumerations.h:115
LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:52
lldb_private::DataExtractor::GetMaxU64
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
Definition: DataExtractor.cpp:524
lldb_private::CompilerType::IsPointerType
bool IsPointerType(CompilerType *pointee_type=nullptr) const
Definition: CompilerType.cpp:182
ABISysV_ppc64::Initialize
static void Initialize()
Definition: ABISysV_ppc64.cpp:1068
lldb_private::CompilerType::GetBitSize
llvm::Optional< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
Definition: CompilerType.cpp:544
lldb_private::Type
Definition: Type.h:66
lldb_private::CompilerType::GetTypeInfo
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
Definition: CompilerType.cpp:329
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
uint16_t
ABISysV_ppc64::GetReturnValueObjectSimple
lldb::ValueObjectSP GetReturnValueObjectSimple(lldb_private::Thread &thread, lldb_private::CompilerType &ast_type) const
Definition: ABISysV_ppc64.cpp:929
ppc64le_dwarf::dwarf_cr_ppc64le
@ dwarf_cr_ppc64le
Definition: PPC64LE_DWARF_Registers.h:83
PluginManager.h
ABISysV_ppc64::GetRegisterInfoArray
const lldb_private::RegisterInfo * GetRegisterInfoArray(uint32_t &count) override
Definition: ABISysV_ppc64.cpp:54
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:337
DataExtractor.h
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:35
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::Value::GetCompilerType
const CompilerType & GetCompilerType()
Definition: Value.cpp:222
Status.h
ppc64le_dwarf::dwarf_lr_ppc64le
@ dwarf_lr_ppc64le
Definition: PPC64LE_DWARF_Registers.h:81
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
ABISysV_ppc64::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: ABISysV_ppc64.cpp:66
LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:51
RegisterInfos_ppc64le.h
ppc64_dwarf::dwarf_lr_ppc64
@ dwarf_lr_ppc64
Definition: PPC64_DWARF_Registers.h:85
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:105
lldb_private::CompilerType::TypeSystemSPWrapper::dyn_cast_or_null
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
Definition: CompilerType.h:67
ConstString.h
lldb_private::DataExtractor::CopyByteOrderedData
lldb::offset_t CopyByteOrderedData(lldb::offset_t src_offset, lldb::offset_t src_len, void *dst, lldb::offset_t dst_len, lldb::ByteOrder dst_byte_order) const
Copy dst_len bytes from *offset_ptr and ensure the copied data is treated as a value that can be swap...
Definition: DataExtractor.cpp:690
ppc64_dwarf::dwarf_pc_ppc64
@ dwarf_pc_ppc64
Definition: PPC64_DWARF_Registers.h:89
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:115
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::Thread::GetRegisterContext
virtual lldb::RegisterContextSP GetRegisterContext()=0
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb::eByteOrderLittle
@ eByteOrderLittle
Definition: lldb-enumerations.h:143
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
lldb_private::UnwindPlan
Definition: UnwindPlan.h:53
lldb
Definition: SBAddress.h:15
RegisterContext.h
LLDB_LOG_ERROR
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:360
Value.h
LLDBLog.h
lldb_private::RegisterContext::GetRegisterInfoByName
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
Definition: RegisterContext.cpp:52
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:139
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
LLDB_REGNUM_GENERIC_RA
#define LLDB_REGNUM_GENERIC_RA
Definition: lldb-defines.h:54