dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pfunct: Introduced --all/-A
@ 2010-04-05  7:31 Rakesh Pandit
       [not found] ` <g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rakesh Pandit @ 2010-04-05  7:31 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

Hello,

I have a request for enhancement (new option in pfunct) via which I
want pfunct to print signatures for all symbols in one go. To add to
it and as expected I want source code information per symbol if -l
option is specified.

Use can for me was: I wanted signature for all symbols from an ELF
file. Repeatedly asking pfunct for all symbols using names had a cost
for me. It used to take substantial time per symbol for uploading ELF
file into memory and searching for sym name and printing required
information. This option will upload it once and print all information
for me.

Can this be considered for inclusion ? If yes, may inline patch be reviewed ?

Thanks,

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first

From 0ee628a9152d24eb75107778784fc170ff03ec8d Mon Sep 17 00:00:00 2001
From: Rakesh Pandit <rakesh-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
Date: Mon, 5 Apr 2010 12:43:47 +0530
Subject: [PATCH] pfunct: Introduced --all/-A

Prints all symbols along with signatures in one go. Depending on other
options e.g -l will also print source code info.

Signed-off-by: Rakesh Pandit <rakesh-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
---
 pfunct.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/pfunct.c b/pfunct.c
index 20dd3bb..0e604b9 100644
--- a/pfunct.c
+++ b/pfunct.c
@@ -29,6 +29,7 @@ static int show_variables;
 static int show_externals;
 static int show_cc_inlined;
 static int show_cc_uninlined;
+static int show_all_functions;
 static char *symtab_name;
 static bool expand_types;
 static struct type_emissions emissions;
@@ -367,6 +368,22 @@ static int cu_function_iterator(struct cu *cu,
void *cookie)
 	return 0;
 }

+static void print_all_functions(struct cus *self)
+{
+	struct cu *pos;
+
+	list_for_each_entry(pos, &self->cus, node) {
+		struct cu *cu = pos;
+		struct function *function;
+		uint32_t id;
+		cu__for_each_function(cu, id, function) {
+			fprintf(stdout, "%s\n", function__name(function, cu));
+			function__show(function, cu);
+			putchar('\n');
+		}
+	}
+}
+
 int elf_symtab__show(char *filename)
 {
 	int fd = open(filename, O_RDONLY), err = -1;
@@ -478,6 +495,11 @@ static const struct argp_option pfunct__options[] = {
 		.doc  = "show just external functions",
 	},
 	{
+		.key  = 'A',
+		.name = "all",
+		.doc  = "show all functions with source code info",
+	},
+	{
 		.key  = 'f',
 		.name = "function",
 		.arg  = "FUNCTION",
@@ -592,6 +614,7 @@ static error_t pfunct__options_parser(int key, char *arg,
 	case 'f': function_name = arg;			 break;
 	case 'F': conf_load.format_path = arg;		 break;
 	case 'E': show_externals = 1;			 break;
+	case 'A': show_all_functions = 1;		 break;
 	case 's': formatter = fn_stats_size_fmtr;
 		  conf_load.get_addr_info = true;	 break;
 	case 'S': formatter = fn_stats_variables_fmtr;	 break;
@@ -669,6 +692,8 @@ int main(int argc, char *argv[])
 			goto out_cus_delete;
 		}
 		function__show(f, cu);
+	} else if (show_all_functions) {
+		print_all_functions(cus);
 	} else if (show_total_inline_expansion_stats)
 		print_total_inline_stats();
 	else if (class_name != NULL)
-- 
1.6.6.1
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pfunct: Introduced --all/-A
       [not found] ` <g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-05-04  6:56   ` Rakesh Pandit
       [not found]     ` <l2nb401d2531005032356q9d0e569fh6f69d57e9f5784e6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rakesh Pandit @ 2010-05-04  6:56 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

On 5 April 2010 13:01, Rakesh Pandit <rakesh.pandit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hello,
>
> I have a request for enhancement (new option in pfunct) via which I
> want pfunct to print signatures for all symbols in one go. To add to
> it and as expected I want source code information per symbol if -l
> option is specified.
>

ping for review ?

Regards,

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pfunct: Introduced --all/-A
       [not found]     ` <l2nb401d2531005032356q9d0e569fh6f69d57e9f5784e6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-05-04 16:18       ` Arnaldo Carvalho de Melo
       [not found]         ` <20100504161803.GD970-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-04 16:18 UTC (permalink / raw)
  To: Rakesh Pandit; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Tue, May 04, 2010 at 12:26:52PM +0530, Rakesh Pandit escreveu:
> On 5 April 2010 13:01, Rakesh Pandit <rakesh.pandit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Hello,
> >
> > I have a request for enhancement (new option in pfunct) via which I
> > want pfunct to print signatures for all symbols in one go. To add to
> > it and as expected I want source code information per symbol if -l
> > option is specified.
> >
> 
> ping for review ?

Isn't:

pfunct -V ~/bin/perf | grep \;$

equivalent?

Perhaps have a new flag to ask that no C comment like lines be issued?

so it would be:

pfunct -V --no-comments objfile

But ok, I'll add a '-P'/'--prototypes' option for that.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pfunct: Introduced --all/-A
       [not found]         ` <20100504161803.GD970-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2010-05-05  3:49           ` Rakesh Pandit
  0 siblings, 0 replies; 4+ messages in thread
From: Rakesh Pandit @ 2010-05-05  3:49 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

On 4 May 2010 21:48, Arnaldo Carvalho de Melo wrote:
[..]
> Perhaps have a new flag to ask that no C comment like lines be issued?
>
> so it would be:
>
> pfunct -V --no-comments objfile
>
> But ok, I'll add a '-P'/'--prototypes' option for that.
>

Thanks for adding this option.

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-05  3:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-05  7:31 [PATCH] pfunct: Introduced --all/-A Rakesh Pandit
     [not found] ` <g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-05-04  6:56   ` Rakesh Pandit
     [not found]     ` <l2nb401d2531005032356q9d0e569fh6f69d57e9f5784e6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-05-04 16:18       ` Arnaldo Carvalho de Melo
     [not found]         ` <20100504161803.GD970-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2010-05-05  3:49           ` Rakesh Pandit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).