misc: tegra-profiler: unwinding: add auto mode
Igor Nabirushkin [Mon, 3 Mar 2014 07:52:22 +0000 (11:52 +0400)]
Tegra Profiler: automatic selection of unwinding
method (frame pointers or exception-handling tables)

Bug 1465331

Change-Id: I8ae85e78b32198c685aab44102f919f33a2bad55
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/377071
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Maxim Morin <mmorin@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/misc/tegra-profiler/backtrace.c
drivers/misc/tegra-profiler/eh_unwind.c
drivers/misc/tegra-profiler/version.h

index 5c10aae..5da1084 100644 (file)
@@ -95,6 +95,7 @@ get_user_callchain_fp(struct pt_regs *regs,
        struct mm_struct *mm = current->mm;
 
        cc->nr = 0;
+       cc->unw_method = QUADD_UNW_METHOD_FP;
 
        if (!regs || !mm)
                return 0;
@@ -168,7 +169,7 @@ quadd_get_user_callchain(struct pt_regs *regs,
                         struct quadd_callchain *cc,
                         struct quadd_ctx *ctx)
 {
-       int unw_fp, unw_eht;
+       int unw_fp, unw_eht, nr = 0;
        unsigned int extra;
        struct quadd_parameters *param = &ctx->param;
 
@@ -184,13 +185,11 @@ quadd_get_user_callchain(struct pt_regs *regs,
 
        cc->unw_rc = 0;
 
-       if (unw_fp) {
-               cc->unw_method = QUADD_UNW_METHOD_FP;
-               get_user_callchain_fp(regs, cc);
-       } else if (unw_eht) {
-               cc->unw_method = QUADD_UNW_METHOD_EHT;
-               quadd_get_user_callchain_ut(regs, cc);
-       }
+       if (unw_eht)
+               nr = quadd_get_user_callchain_ut(regs, cc);
 
-       return cc->nr;
+       if (!nr && unw_fp)
+               nr = get_user_callchain_fp(regs, cc);
+
+       return nr;
 }
index 9e411d6..0703f96 100644 (file)
@@ -831,6 +831,7 @@ quadd_get_user_callchain_ut(struct pt_regs *regs,
        struct ex_region_info *ri;
        struct extables tabs;
 
+       cc->unw_method = QUADD_UNW_METHOD_EHT;
        cc->unw_rc = QUADD_URC_FAILURE;
 
        if (!regs || !mm)
index 1ecb006..ff6da74 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.55"
+#define QUADD_MODULE_VERSION           "1.56"
 #define QUADD_MODULE_BRANCH            "Dev"
 
 #endif /* __QUADD_VERSION_H */