dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rakesh Pandit <rakesh.pandit-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] pfunct: Introduced --all/-A
Date: Mon, 5 Apr 2010 13:01:58 +0530	[thread overview]
Message-ID: <g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-04-05  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05  7:31 Rakesh Pandit [this message]
     [not found] ` <g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-05-04  6:56   ` [PATCH] pfunct: Introduced --all/-A 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=g2wb401d2531004050031q14f3fb12y39f4e7b0316526c0@mail.gmail.com \
    --to=rakesh.pandit-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).