[PATCH] stack: Add --quiet to not resolve addresses, add --raw to not demangle.

Mark Wielaard mjw at redhat.com
Thu Jan 2 23:09:04 UTC 2014


On Thu, Jan 02, 2014 at 09:31:14PM +0100, Jan Kratochvil wrote:
> On Mon, 23 Dec 2013 21:35:41 +0100, Mark Wielaard wrote:
> > +#ifdef USE_DEMANGLE
> > +    case 'r':
> > +      show_raw = true;
> > +      break;
> > +#endif
> 
> It is more a nitpick but I do not find too great that a build without
> demangling support will fail "eu-stack -r ..." with:
> 	eu-stack: invalid option -- 'r'
> 	Try `stack --help' or `stack --usage' for more information.
> 
> Despite it could display the information requested.
> 
> -r should be IMO just ignored for builds without demangling support.
> The demangling would be just a best-effort.  After all a mangled symbol name
> is still a valid symbol name.

Yes, that makes sense.

Thanks,

Mark
-------------- next part --------------
>From da91c5bb6997aa562d82ed964ab798bd6c7ac8cd Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw at redhat.com>
Date: Fri, 3 Jan 2014 00:06:31 +0100
Subject: [PATCH] stack: Show and handle -r,--raw even without USE_DEMANGLE.

Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 src/ChangeLog | 6 ++++++
 src/stack.c   | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 8f1df36..d37cd1b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
 2014-01-02  Mark Wielaard  <mjw at redhat.com>
 
+	* stack.c (show_raw): Declare unconditionally.
+	(parse_opt): Handle '-r' unconditionally.
+	(main): Show "raw" option even without USE_DEMANGLE.
+
+2014-01-02  Mark Wielaard  <mjw at redhat.com>
+
 	* stack.c (print_frames): Print 0x before build-id hex-offset.
 
 2014-01-02  Mark Wielaard  <mjw at redhat.com>
diff --git a/src/stack.c b/src/stack.c
index 623dc5f..fdf4b07 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -47,9 +47,7 @@ static bool show_build_id = false;
 static bool show_source = false;
 static bool show_one_tid = false;
 static bool show_quiet = false;
-#ifdef USE_DEMANGLE
 static bool show_raw = false;
-#endif
 static bool show_modules = false;
 
 static int maxframes = 2048;
@@ -395,11 +393,9 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
       show_quiet = true;
       break;
 
-#ifdef USE_DEMANGLE
     case 'r':
       show_raw = true;
       break;
-#endif
 
     case '1':
       show_one_tid = true;
@@ -517,10 +513,8 @@ main (int argc, char **argv)
 	N_("Show all additional information (activation, module and source)"), 0 },
       { "quiet", 'q', NULL, 0,
 	N_("Do not resolve address to function symbol name"), 0 },
-#ifdef USE_DEMANGLE
       { "raw", 'r', NULL, 0,
 	N_("Show raw function symbol names, do not try to demangle names"), 0 },
-#endif
       { "build-id",  'b', NULL, 0,
 	N_("Show module build-id, load address and pc offset"), 0 },
       { NULL, '1', NULL, 0,
-- 
1.8.4.2



More information about the elfutils-devel mailing list