Hi,
  I am trying to capture user stack callgraph on MIPS64R6EL platform(Boston), 
but unfortunately I failed to get the user stack unwind info.
  My environment info is:
      kernel version: 5.0-rc1
      libunwind: 1.3.1
      test platform: Qemu for boston
  I applied the patch from David Daney and made some modification for linux 
kernel 5.0.
  I use 'perf record --call-graph dwarf ./test' to record, but only get 
following info:
  #
    38.95%    38.95%  2-mips-2  2-mips-2           [.] .L12
            |
            ---test_hi (inlined!!)

    38.95%     0.00%  2-mips-2  2-mips-2           [.] test_hi (inlined)
            |
            ---test_hi (inlined!!)

    30.05%    30.05%  2-mips-2  2-mips-2           [.] .L9
            |
            ---test_high (inlined!!)

    30.05%     0.00%  2-mips-2  2-mips-2           [.] test_high (inlined)
            |
            ---test_high (inlined!!)

   The same test program running under x86 can get full call graph from main to 
test_high etc:
   -   41.12%    41.10%  2        2                  [.] test_hi
     41.09% _start
        __libc_start_main
        main
        test_hi
-   32.44%    32.39%  2        2                  [.] test_high
     32.39% _start
        __libc_start_main
        main
        test_high
   According to the discuss between Luke and 
Sapir(https://lists.libreplanet.org/archive/html/libunwind-devel/2018-07/msg00005.html),
 I double checked .eh_frame section has already been generated.
  Two things are weird:
  1. in _Umips_dwarf_search_unwind_table, IP register value is out of the range 
betwee pi->start_ip and pi->end_ip, this directs unw_step return error and 
could find the stack levels.
  2. The test_high function are cross assembled into following three sections 
and in the perf sample, the user IP register always pointer to section .L9 not 
section test_high. I am not sure if this directs the unwind info can't be 
decoded correctly.

0000000000000da0 <test_high>:
     da0:       67bdffd0        daddiu  sp,sp,-48
     da4:       ffbf0028        sd      ra,40(sp)
     da8:       ffbe0020        sd      s8,32(sp)
     dac:       ffbc0018        sd      gp,24(sp)
     db0:       03a0f025        move    s8,sp
     db4:       3c1c0002        lui     gp,0x2
     db8:       0399e02d        daddu   gp,gp,t9
     dbc:       679c8670        daddiu  gp,gp,-31120
     dc0:       df828060        ld      v0,-32672(gp)
     dc4:       0040c825        move    t9,v0
     dc8:       f8190000        jalrc   t9
     dcc:       afc00000        sw      zero,0(s8)
     dd0:       c8000005        bc      de8 <.L8>

0000000000000dd4 <.L9>:
     dd4:       8fc20000        lw      v0,0(s8)
     dd8:       afc20004        sw      v0,4(s8)
     ddc:       8fc20000        lw      v0,0(s8)
     de0:       24420001        addiu   v0,v0,1
     de4:       afc20000        sw      v0,0(s8)

0000000000000de8 <.L8>:
     de8:       8fc20000        lw      v0,0(s8)
     dec:       3c03055d        lui     v1,0x55d
     df0:       34634a7f        ori     v1,v1,0x4a7f
     df4:       5862fff7        bgec    v1,v0,dd4 <.L9>
     df8:       00000000        nop
     dfc:       03c0e825        move    sp,s8
     e00:       dfbf0028        ld      ra,40(sp)
     e04:       dfbe0020        ld      s8,32(sp)
     e08:       dfbc0018        ld      gp,24(sp)
     e0c:       67bd0030        daddiu  sp,sp,48
     e10:       d81f0000        jrc     ra

  Could you please help with this? Any suggestion is welcomed:).
From 07b35c200719a9343a0562085628186774ad6ed7 Mon Sep 17 00:00:00 2001
From: David Daney <[email protected]>
Date: Fri, 15 Feb 2019 14:25:47 +0800
Subject: [PATCH 1/2] Hack up the Makefile and add support code for mips
 unwinding and dwarf-regs.

Signed-off-by: David Daney <[email protected]>
Cc: [email protected]
Cc: Jiri Olsa <[email protected]>
Cc: [email protected]
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Ralf Baechle <[email protected]>
Signed-off-by: Archer Yan <[email protected]>
---
 tools/perf/arch/mips/Build                   |  2 +-
 tools/perf/arch/mips/Makefile                |  7 ++
 tools/perf/arch/mips/include/perf_regs.h     | 84 ++++++++++++++++++++
 tools/perf/arch/mips/util/Build              |  2 +
 tools/perf/arch/mips/util/dwarf-regs.c       | 37 +++++++++
 tools/perf/arch/mips/util/unwind-libunwind.c | 20 +++++
 6 files changed, 151 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/mips/Makefile
 create mode 100644 tools/perf/arch/mips/include/perf_regs.h
 create mode 100644 tools/perf/arch/mips/util/Build
 create mode 100644 tools/perf/arch/mips/util/dwarf-regs.c
 create mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c

diff --git a/tools/perf/arch/mips/Build b/tools/perf/arch/mips/Build
index 1bb8bf6d7fd4..54afe4a467e7 100644
--- a/tools/perf/arch/mips/Build
+++ b/tools/perf/arch/mips/Build
@@ -1 +1 @@
-# empty
+libperf-y += util/
diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
new file mode 100644
index 000000000000..fe9b61e322a5
--- /dev/null
+++ b/tools/perf/arch/mips/Makefile
@@ -0,0 +1,7 @@
+ifndef NO_DWARF
+PERF_HAVE_DWARF_REGS := 1
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
+endif
+ifndef NO_LIBUNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
+endif
diff --git a/tools/perf/arch/mips/include/perf_regs.h b/tools/perf/arch/mips/include/perf_regs.h
new file mode 100644
index 000000000000..9edd152674f3
--- /dev/null
+++ b/tools/perf/arch/mips/include/perf_regs.h
@@ -0,0 +1,84 @@
+#ifndef ARCH_PERF_REGS_H
+#define ARCH_PERF_REGS_H
+
+#include <stdlib.h>
+#include "../../util/types.h"
+#include <asm/perf_regs.h>
+
+#define PERF_REG_IP PERF_REG_MIPS_PC
+#define PERF_REG_SP PERF_REG_MIPS_R29
+
+#define PERF_REGS_MASK ((1ULL << PERF_REG_MIPS_MAX) - 1)
+
+static inline const char *perf_reg_name(int id)
+{
+       switch (id) {
+       case PERF_REG_MIPS_PC:
+               return "PC";
+       case PERF_REG_MIPS_R1:
+               return "$1";
+       case PERF_REG_MIPS_R2:
+               return "$2";
+       case PERF_REG_MIPS_R3:
+               return "$3";
+       case PERF_REG_MIPS_R4:
+               return "$4";
+       case PERF_REG_MIPS_R5:
+               return "$5";
+       case PERF_REG_MIPS_R6:
+               return "$6";
+       case PERF_REG_MIPS_R7:
+               return "$7";
+       case PERF_REG_MIPS_R8:
+               return "$8";
+       case PERF_REG_MIPS_R9:
+               return "$9";
+       case PERF_REG_MIPS_R10:
+               return "$10";
+       case PERF_REG_MIPS_R11:
+               return "$11";
+       case PERF_REG_MIPS_R12:
+               return "$12";
+       case PERF_REG_MIPS_R13:
+               return "$13";
+       case PERF_REG_MIPS_R14:
+               return "$14";
+       case PERF_REG_MIPS_R15:
+               return "$15";
+       case PERF_REG_MIPS_R16:
+               return "$16";
+       case PERF_REG_MIPS_R17:
+               return "$17";
+       case PERF_REG_MIPS_R18:
+               return "$18";
+       case PERF_REG_MIPS_R19:
+               return "$19";
+       case PERF_REG_MIPS_R20:
+               return "$20";
+       case PERF_REG_MIPS_R21:
+               return "$21";
+       case PERF_REG_MIPS_R22:
+               return "$22";
+       case PERF_REG_MIPS_R23:
+               return "$23";
+       case PERF_REG_MIPS_R24:
+               return "$24";
+       case PERF_REG_MIPS_R25:
+               return "$25";
+
+       case PERF_REG_MIPS_R28:
+               return "$28";
+       case PERF_REG_MIPS_R29:
+               return "$29";
+       case PERF_REG_MIPS_R30:
+               return "$30";
+       case PERF_REG_MIPS_R31:
+               return "$31";
+       default:
+               break;
+       }
+       return NULL;
+}
+
+
+#endif /* ARCH_PERF_REGS_H */
diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Build
new file mode 100644
index 000000000000..7da83b5ebc4c
--- /dev/null
+++ b/tools/perf/arch/mips/util/Build
@@ -0,0 +1,2 @@
+libperf-$(CONFIG_DWARF)                += dwarf-regs.o
+libperf-$(CONFIG_LIBUNWIND)    += unwind-libunwind.o
diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/util/dwarf-regs.c
new file mode 100644
index 000000000000..6c6305f0930a
--- /dev/null
+++ b/tools/perf/arch/mips/util/dwarf-regs.c
@@ -0,0 +1,37 @@
+/*
+ * dwarf-regs.c : Mapping of DWARF debug register numbers into register names.
+ *
+ * Copyright (C) 2013 Cavium, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <libio.h>
+#include <dwarf-regs.h>
+
+static const char *mips_gpr_names[32] = {
+       "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9",
+       "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19",
+       "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29",
+       "$30", "$31"
+};
+
+const char *get_arch_regstr(unsigned int n)
+{
+       if (n < 32)
+               return mips_gpr_names[n];
+       if (n == 64)
+               return "hi";
+       if (n == 65)
+               return "lo";
+       return NULL;
+}
diff --git a/tools/perf/arch/mips/util/unwind-libunwind.c b/tools/perf/arch/mips/util/unwind-libunwind.c
new file mode 100644
index 000000000000..6c98d4a90a04
--- /dev/null
+++ b/tools/perf/arch/mips/util/unwind-libunwind.c
@@ -0,0 +1,20 @@
+
+#include <errno.h>
+#include <libunwind.h>
+#include "perf_regs.h"
+#include "../../util/unwind.h"
+
+int unwind__arch_reg_id(int regnum)
+{
+       switch (regnum) {
+       case UNW_MIPS_R1 ... UNW_MIPS_R25:
+               return regnum - UNW_MIPS_R1 + PERF_REG_MIPS_R1;
+       case UNW_MIPS_R28 ... UNW_MIPS_R31:
+               return regnum - UNW_MIPS_R28 + PERF_REG_MIPS_R28;
+       case UNW_MIPS_PC:
+               return PERF_REG_MIPS_PC;
+       default:
+               pr_err("unwind: invalid reg id %d\n", regnum);
+               return -EINVAL;
+       }
+}
-- 
2.17.1

From bd4a0294d8d49b167f0ed75cc88be20190b5f0e1 Mon Sep 17 00:00:00 2001
From: Archer Yan <[email protected]>
Date: Fri, 22 Feb 2019 23:36:40 +0800
Subject: [PATCH 2/2] Fit old perf mips patch with latest kernel version

Signed-off-by: Archer Yan <[email protected]>
---
 arch/mips/Kconfig                             | 12 ++++
 arch/mips/include/uapi/asm/perf_regs.h        | 41 ++++++++++++
 arch/mips/kernel/Makefile                     |  2 +-
 arch/mips/kernel/perf_regs.c                  | 67 +++++++++++++++++++
 tools/perf/Makefile.config                    |  6 ++
 tools/perf/arch/mips/Makefile                 |  4 --
 .../perf/arch/mips/include/dwarf-regs-table.h | 30 +++++++++
 tools/perf/arch/mips/include/perf_regs.h      |  2 +-
 tools/perf/arch/mips/util/dwarf-regs.c        |  3 +-
 tools/perf/arch/mips/util/unwind-libunwind.c  |  3 +-
 tools/perf/util/dwarf-regs.c                  |  3 +
 tools/perf/util/thread.c                      |  1 -
 12 files changed, 164 insertions(+), 10 deletions(-)
 create mode 100644 arch/mips/include/uapi/asm/perf_regs.h
 create mode 100644 arch/mips/kernel/perf_regs.c
 create mode 100644 tools/perf/arch/mips/include/dwarf-regs-table.h

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 787290781b8c..c0cbe1995e34 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -68,7 +68,19 @@ config MIPS
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_NMI
 	select HAVE_OPROFILE
+	select FTRACE
+	select FUNCTION_TRACER
+	select STACK_TRACER
+	select TRACING
+	select KPROBES
+	select PERF_EVENTS
+	select HW_PERF_EVENTS
+	select DEBUG_PERF_USE_VMALLOC
 	select HAVE_PERF_EVENTS
+	select HAVE_PERF_REGS
+	select HAVE_PERF_USER_STACK_DUMP
+	select FRAME_POINTER
+	select ARCH_WANT_FRAME_POINTERS
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_RSEQ
 	select HAVE_STACKPROTECTOR
diff --git a/arch/mips/include/uapi/asm/perf_regs.h b/arch/mips/include/uapi/asm/perf_regs.h
new file mode 100644
index 000000000000..412d6e157b54
--- /dev/null
+++ b/arch/mips/include/uapi/asm/perf_regs.h
@@ -0,0 +1,41 @@
+#ifndef _ASM_MIPS_PERF_REGS_H
+#define _ASM_MIPS_PERF_REGS_H
+
+enum perf_event_mips_regs {
+       PERF_REG_MIPS_PC,
+       PERF_REG_MIPS_R1,
+       PERF_REG_MIPS_R2,
+       PERF_REG_MIPS_R3,
+       PERF_REG_MIPS_R4,
+       PERF_REG_MIPS_R5,
+       PERF_REG_MIPS_R6,
+       PERF_REG_MIPS_R7,
+       PERF_REG_MIPS_R8,
+       PERF_REG_MIPS_R9,
+       PERF_REG_MIPS_R10,
+       PERF_REG_MIPS_R11,
+       PERF_REG_MIPS_R12,
+       PERF_REG_MIPS_R13,
+       PERF_REG_MIPS_R14,
+       PERF_REG_MIPS_R15,
+       PERF_REG_MIPS_R16,
+       PERF_REG_MIPS_R17,
+       PERF_REG_MIPS_R18,
+       PERF_REG_MIPS_R19,
+       PERF_REG_MIPS_R20,
+       PERF_REG_MIPS_R21,
+       PERF_REG_MIPS_R22,
+       PERF_REG_MIPS_R23,
+       PERF_REG_MIPS_R24,
+       PERF_REG_MIPS_R25,
+       /*
+        * 26 and 27 are k0 and k1, they are always clobbered thus not
+        * stored.
+        */
+       PERF_REG_MIPS_R28,
+       PERF_REG_MIPS_R29,
+       PERF_REG_MIPS_R30,
+       PERF_REG_MIPS_R31,
+       PERF_REG_MIPS_MAX = PERF_REG_MIPS_R31 + 1,
+};
+#endif /* _ASM_MIPS_PERF_REGS_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 89b07ea8d249..d8fb04540505 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -100,7 +100,7 @@ CFLAGS_cpu-bugs64.o	= $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/n
 
 obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT)	+= 8250-platform.o
 
-obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o
+obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_regs.o
 obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event_mipsxx.o
 
 obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
diff --git a/arch/mips/kernel/perf_regs.c b/arch/mips/kernel/perf_regs.c
new file mode 100644
index 000000000000..b5eea4bd1d18
--- /dev/null
+++ b/arch/mips/kernel/perf_regs.c
@@ -0,0 +1,67 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Some parts derived from x86 version of this file.
+ *
+ * Copyright (C) 2013 Cavium, Inc.
+ */
+
+#include <linux/perf_event.h>
+
+#include <asm/ptrace.h>
+
+#ifdef CONFIG_32BIT
+u64 perf_reg_abi(struct task_struct *tsk)
+{
+       return PERF_SAMPLE_REGS_ABI_32;
+}
+#else /* Must be CONFIG_64BIT */
+u64 perf_reg_abi(struct task_struct *tsk)
+{
+       if (test_tsk_thread_flag(tsk, TIF_32BIT_REGS))
+               return PERF_SAMPLE_REGS_ABI_32;
+       else
+               return PERF_SAMPLE_REGS_ABI_64;
+}
+#endif /* CONFIG_32BIT */
+
+int perf_reg_validate(u64 mask)
+{
+       if (!mask)
+               return -EINVAL;
+       if (mask & ~((1ull << PERF_REG_MIPS_MAX) - 1))
+               return -EINVAL;
+       return 0;
+}
+
+u64 perf_reg_value(struct pt_regs *regs, int idx)
+{
+       long v;
+
+       switch (idx) {
+       case PERF_REG_MIPS_PC:
+               v = regs->cp0_epc;
+               break;
+       case PERF_REG_MIPS_R1 ... PERF_REG_MIPS_R25:
+               v = regs->regs[idx - PERF_REG_MIPS_R1 + 1];
+               break;
+       case PERF_REG_MIPS_R28 ... PERF_REG_MIPS_R31:
+               v = regs->regs[idx - PERF_REG_MIPS_R28 + 28];
+               break;
+
+       default:
+               WARN_ON_ONCE(1);
+               return 0;
+       }
+
+       return (s64)v; /* Sign extend if 32-bit. */
+}
+
+void perf_get_regs_user(struct perf_regs *regs_user,
+       struct pt_regs *regs, struct pt_regs *regs_user_copy)
+{
+       regs_user->regs = task_pt_regs(current);
+       regs_user->abi = perf_reg_abi(current);
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b441c88cafa1..cdce134512a3 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -69,6 +69,12 @@ ifeq ($(NO_PERF_REGS),0)
   $(call detected,CONFIG_PERF_REGS)
 endif
 
+ifeq ($(ARCH),mips)
+  NO_PERF_REGS := 0
+  CFLAGS += -I../../arch/mips/include/uapi -I../../arch/mips/include/generated/uapi
+  LIBUNWIND_LIBS = -lunwind -lunwind-mips
+endif
+
 ifneq ($(NO_SYSCALL_TABLE),1)
   CFLAGS += -DHAVE_SYSCALL_TABLE_SUPPORT
 endif
diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
index fe9b61e322a5..7fbca175099e 100644
--- a/tools/perf/arch/mips/Makefile
+++ b/tools/perf/arch/mips/Makefile
@@ -1,7 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
 endif
diff --git a/tools/perf/arch/mips/include/dwarf-regs-table.h b/tools/perf/arch/mips/include/dwarf-regs-table.h
new file mode 100644
index 000000000000..b7bd82fe20af
--- /dev/null
+++ b/tools/perf/arch/mips/include/dwarf-regs-table.h
@@ -0,0 +1,30 @@
+/*
+ * dwarf-regs-table.h : Mapping of DWARF debug register numbers into register names.
+ *
+ * Copyright (C) 2013 Cavium, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifdef DEFINE_DWARF_REGSTR_TABLE
+#undef REG_DWARFNUM_NAME
+#define REG_DWARFNUM_NAME(reg, idx)     [idx] = "$" #reg
+static const char *mips_regstr_tbl[] = {
+       "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9",
+       "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19",
+       "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29",
+       "$30", "$31",
+       REG_DWARFNUM_NAME(hi,   64),
+       REG_DWARFNUM_NAME(lo,   65),
+
+};
+#endif
diff --git a/tools/perf/arch/mips/include/perf_regs.h b/tools/perf/arch/mips/include/perf_regs.h
index 9edd152674f3..2951bad6ecd8 100644
--- a/tools/perf/arch/mips/include/perf_regs.h
+++ b/tools/perf/arch/mips/include/perf_regs.h
@@ -2,9 +2,9 @@
 #define ARCH_PERF_REGS_H
 
 #include <stdlib.h>
-#include "../../util/types.h"
 #include <asm/perf_regs.h>
 
+#define PERF_REGS_MAX PERF_REG_MIPS_MAX
 #define PERF_REG_IP PERF_REG_MIPS_PC
 #define PERF_REG_SP PERF_REG_MIPS_R29
 
diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/util/dwarf-regs.c
index 6c6305f0930a..2b4b428478e7 100644
--- a/tools/perf/arch/mips/util/dwarf-regs.c
+++ b/tools/perf/arch/mips/util/dwarf-regs.c
@@ -14,8 +14,7 @@
  * GNU General Public License for more details.
  *
  */
-
-#include <libio.h>
+#include <stdio.h>
 #include <dwarf-regs.h>
 
 static const char *mips_gpr_names[32] = {
diff --git a/tools/perf/arch/mips/util/unwind-libunwind.c b/tools/perf/arch/mips/util/unwind-libunwind.c
index 6c98d4a90a04..fc4e6bbf7a9e 100644
--- a/tools/perf/arch/mips/util/unwind-libunwind.c
+++ b/tools/perf/arch/mips/util/unwind-libunwind.c
@@ -3,8 +3,9 @@
 #include <libunwind.h>
 #include "perf_regs.h"
 #include "../../util/unwind.h"
+#include "util/debug.h"
 
-int unwind__arch_reg_id(int regnum)
+int libunwind__arch_reg_id(int regnum)
 {
        switch (regnum) {
        case UNW_MIPS_R1 ... UNW_MIPS_R25:
diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c
index db55eddce8cd..0bf60e6d28b5 100644
--- a/tools/perf/util/dwarf-regs.c
+++ b/tools/perf/util/dwarf-regs.c
@@ -25,6 +25,7 @@
 #include "../arch/s390/include/dwarf-regs-table.h"
 #include "../arch/sparc/include/dwarf-regs-table.h"
 #include "../arch/xtensa/include/dwarf-regs-table.h"
+#include "../arch/mips/include/dwarf-regs-table.h"
 
 #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] : NULL)
 
@@ -54,6 +55,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine)
 		return __get_dwarf_regstr(sparc_regstr_tbl, n);
 	case EM_XTENSA:
 		return __get_dwarf_regstr(xtensa_regstr_tbl, n);
+	case EM_MIPS:
+		return __get_dwarf_regstr(mips_regstr_tbl, n);
 	default:
 		pr_err("ELF MACHINE %x is not supported.\n", machine);
 	}
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index c83372329f89..19b4e5f2f579 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -290,7 +290,6 @@ size_t thread__fprintf(struct thread *thread, FILE *fp)
 int thread__insert_map(struct thread *thread, struct map *map)
 {
 	int ret;
-
 	ret = unwind__prepare_access(thread, map, NULL);
 	if (ret)
 		return ret;
-- 
2.17.1

_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to