]> granicus.if.org Git - strace/commitdiff
process: honor xlat style in print_user_offset_addr
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 31 Aug 2018 07:01:24 +0000 (09:01 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 4 Sep 2018 11:13:52 +0000 (11:13 +0000)
* process.c (print_user_offset_addr): Print in accordance with xlat
verbosity setting.

process.c

index 4780311369b25e29359dbbf31cec3265ad795853..1d2e999a381dd53e10a327c5c5bcffcb704125b3 100644 (file)
--- a/process.c
+++ b/process.c
@@ -60,6 +60,7 @@ static const struct xlat struct_user_offsets[] = {
 static void
 print_user_offset_addr(const kernel_ulong_t addr)
 {
+       bool no_str = false;
        const struct xlat *x;
 
        for (x = struct_user_offsets; x->str; ++x) {
@@ -67,19 +68,26 @@ print_user_offset_addr(const kernel_ulong_t addr)
                        break;
        }
 
-       if (!x->str) {
+       if (!x->str || (x == struct_user_offsets && x->val > addr))
+               no_str = true;
+       if (no_str || xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
                printaddr(addr);
-       } else if (x->val > addr) {
-               if (x == struct_user_offsets) {
-                       printaddr(addr);
-               } else {
-                       --x;
-                       tprintf("%s + %" PRI_klu,
-                               x->str, addr - (kernel_ulong_t) x->val);
-               }
+       if (no_str || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
+               return;
+
+       if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
+               tprints(" /* ");
+
+       if (x->val > addr) {
+               --x;
+               tprintf("%s + %" PRI_klu,
+                       x->str, addr - (kernel_ulong_t) x->val);
        } else {
                tprints(x->str);
        }
+
+       if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
+               tprints(" */");
 }
 
 SYS_FUNC(ptrace)