]> granicus.if.org Git - strace/commitdiff
Add user interface for configuring xlat output style
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 10 Mar 2018 04:12:45 +0000 (05:12 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 20 Apr 2018 12:39:05 +0000 (12:39 +0000)
* strace.c (init): Handle -X option, set xlat_verbosity
according to -X argument.
* strace.1.in: Document -X option.
* NEWS: Mention it.

Closes: https://github.com/strace/strace/issues/27
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
NEWS
strace.1.in
strace.c

diff --git a/NEWS b/NEWS
index 3da6c17593c211cb55133e422c6f87b02fd63aed..66304fb8d32940a47c622f3129ca8a047a0b9957 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Noteworthy changes in release ?.?? (????-??-??)
     using --with-libdw option.
     Whether -k option is compiled is now configured at build time
     using --enable-stacktrace option.
+  * Added -X option for configuring xlat output formatting.
 
 Noteworthy changes in release 4.22 (2018-04-05)
 ===============================================
index 46ffc999ccf1aead94728993e89fcab832f8752b..b15c17e21d2ddc8d200ef3ba0925fd4f8ce810d0 100644 (file)
@@ -65,6 +65,7 @@ strace \- trace system calls and signals
 .OP \-a column
 .OP \-o file
 .OP \-s strsize
+.OP \-X format
 .OM \-P path
 .OM \-p pid
 .BR "" {
@@ -325,6 +326,27 @@ Print all non-ASCII strings in hexadecimal string format.
 .B \-xx
 Print all strings in hexadecimal string format.
 .TP
+.BI "\-X " format
+Set the format for printing of named constants and flags.
+Supported
+.I format
+values are:
+.RS
+.TP 10
+.B raw
+Raw number output, without decoding.
+.TP
+.B abbrev
+Output a named constant or a set of flags instead of the raw number if they are
+found.
+This is the default
+.B strace
+behaviour.
+.TP
+.B verbose
+Output both the raw value and the decoded string (as a comment).
+.RE
+.TP
 .B \-y
 Print paths associated with file descriptor arguments.
 .TP
index 7b79b0c5cb9191f0ac0e2fe3a3558dd5a2f87351..4f41a25960f320fcf0fb96fb55e133db8feec6b9 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1595,7 +1595,7 @@ init(int argc, char *argv[])
 #ifdef ENABLE_STACKTRACE
            "k"
 #endif
-           "a:Ab:cCdDe:E:fFhiI:o:O:p:P:qrs:S:tTu:vVwxyz")) != EOF) {
+           "a:Ab:cCdDe:E:fFhiI:o:O:p:P:qrs:S:tTu:vVwxX:yz")) != EOF) {
                switch (c) {
                case 'a':
                        acolumn = string_to_uint(optarg);
@@ -1710,6 +1710,16 @@ init(int argc, char *argv[])
                case 'x':
                        xflag++;
                        break;
+               case 'X':
+                       if (!strcmp(optarg, "raw"))
+                               xlat_verbosity = XLAT_STYLE_RAW;
+                       else if (!strcmp(optarg, "abbrev"))
+                               xlat_verbosity = XLAT_STYLE_ABBREV;
+                       else if (!strcmp(optarg, "verbose"))
+                               xlat_verbosity = XLAT_STYLE_VERBOSE;
+                       else
+                               error_opt_arg(c, optarg);
+                       break;
                case 'y':
                        show_fd_path++;
                        break;