0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. Strip of sysroot from module name is required when _stp_umodule_relocate
  7. call is generated. Otherwise path won't match path on target and could
  8. will fail to calculated address within the file.
  9. Upstream-Status: Backport
  10. Signed-off-by: Victor Kamensky <kamensky@cisco.com>
  11. ---
  12. loc2stap.cxx | 5 ++++-
  13. 1 file changed, 4 insertions(+), 1 deletion(-)
  14. diff --git a/loc2stap.cxx b/loc2stap.cxx
  15. index 4818ee0..e09954f 100644
  16. --- a/loc2stap.cxx
  17. +++ b/loc2stap.cxx
  18. @@ -17,6 +17,7 @@
  19. #include "loc2stap.h"
  20. #include "dwflpp.h"
  21. +#include "tapsets.h"
  22. #if ! _ELFUTILS_PREREQ(0, 153)
  23. #define DW_OP_GNU_entry_value 0xf3
  24. @@ -106,7 +107,9 @@ location_context::translate_address(Dwarf_Addr addr)
  25. c = "/* pragma:vma */ "
  26. "({ unsigned long addr = 0; "
  27. "addr = _stp_umodule_relocate (\""
  28. - + resolve_path(dw->module_name.c_str()) + "\", "
  29. + + path_remove_sysroot(dw->sess,
  30. + resolve_path(dw->module_name.c_str()))
  31. + + "\", "
  32. + lex_cast_hex (addr)
  33. + ", current); addr; })";
  34. }