dwarf-regs.c 600 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Mapping of DWARF debug register numbers into register names.
  4. *
  5. * Copyright IBM Corp. 2010
  6. * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
  7. *
  8. */
  9. #include <stddef.h>
  10. #include <dwarf-regs.h>
  11. #define NUM_GPRS 16
  12. static const char *gpr_names[NUM_GPRS] = {
  13. "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
  14. "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
  15. };
  16. const char *get_arch_regstr(unsigned int n)
  17. {
  18. if (n == 64)
  19. return "mask";
  20. if (n == 65)
  21. return "pc";
  22. return (n >= NUM_GPRS) ? NULL : gpr_names[n];
  23. }