Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 1 | From 183c7a7a8167333c873525f7908913837b8dc3cb Mon Sep 17 00:00:00 2001 |
| 2 | From: Victor Kamensky <kamensky@cisco.com> |
| 3 | Date: Tue, 20 Mar 2018 12:41:05 -0500 |
| 4 | Subject: [PATCH] _stp_umodule_relocate needs target file path, not host file |
| 5 | path |
| 6 | |
| 7 | Strip of sysroot from module name is required when _stp_umodule_relocate |
| 8 | call is generated. Otherwise path won't match path on target and could |
| 9 | will fail to calculated address within the file. |
| 10 | |
| 11 | Upstream-Status: Backport |
| 12 | Signed-off-by: Victor Kamensky <kamensky@cisco.com> |
| 13 | --- |
| 14 | loc2stap.cxx | 5 ++++- |
| 15 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/loc2stap.cxx b/loc2stap.cxx |
| 18 | index 4818ee0..e09954f 100644 |
| 19 | --- a/loc2stap.cxx |
| 20 | +++ b/loc2stap.cxx |
| 21 | @@ -17,6 +17,7 @@ |
| 22 | |
| 23 | #include "loc2stap.h" |
| 24 | #include "dwflpp.h" |
| 25 | +#include "tapsets.h" |
| 26 | |
| 27 | #if ! _ELFUTILS_PREREQ(0, 153) |
| 28 | #define DW_OP_GNU_entry_value 0xf3 |
| 29 | @@ -106,7 +107,9 @@ location_context::translate_address(Dwarf_Addr addr) |
| 30 | c = "/* pragma:vma */ " |
| 31 | "({ unsigned long addr = 0; " |
| 32 | "addr = _stp_umodule_relocate (\"" |
| 33 | - + resolve_path(dw->module_name.c_str()) + "\", " |
| 34 | + + path_remove_sysroot(dw->sess, |
| 35 | + resolve_path(dw->module_name.c_str())) |
| 36 | + + "\", " |
| 37 | + lex_cast_hex (addr) |
| 38 | + ", current); addr; })"; |
| 39 | } |