* [PATCH 1/4] perf tools: configure tmp path at build time
2012-09-20 22:13 [PATCH 0/4] perf: android: configure hardcoded paths Irina Tirdea
@ 2012-09-20 22:13 ` Irina Tirdea
2012-09-21 7:47 ` Pekka Enberg
2012-09-20 22:13 ` [PATCH 2/4] perf tools: configure shell path at compile time Irina Tirdea
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Irina Tirdea @ 2012-09-20 22:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra
Cc: LKML, Paul Mackerras, David Ahern, Namhyung Kim, Pekka Enberg,
Jiri Olsa, Irina Tirdea
From: Irina Tirdea <irina.tirdea@intel.com>
Temporary perf files are hardcoded to point to /tmp. Android does not have
a /tmp directory so it needs to set this path at compile time.
Add a compile-time definition (PERF_TMP_DIR) in the Makefile that sets the path
to temp directory. By default it points to /tmp.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 16 +++++++++++++++-
tools/perf/perf-archive.sh | 13 +++++++++++--
tools/perf/util/dso-test-data.c | 2 +-
tools/perf/util/map.c | 3 ++-
tools/perf/util/pmu.c | 2 +-
tools/perf/util/symbol.c | 2 +-
tools/perf/util/trace-event-info.c | 2 +-
7 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5077f8e..eab4a36 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -139,6 +139,7 @@ sysconfdir = $(prefix)/etc
ETC_PERFCONFIG = etc/perfconfig
endif
lib = lib
+PERF_TMP_DIR = /tmp
export prefix bindir sharedir sysconfdir
@@ -246,7 +247,8 @@ $(OUTPUT)util/pmu-bison.c: util/pmu.y
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
-$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
+$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu.c $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
LIB_FILE=$(OUTPUT)libperf.a
@@ -880,6 +882,18 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
+$(OUTPUT)util/dso-test-data.o: util/dso-test-data.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
+
+$(OUTPUT)util/map.o: util/map.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
+
+$(OUTPUT)util/symbol.o: util/symbol.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
+
+$(OUTPUT)util/trace-event-info.o: util/trace-event-info.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
+
$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
index e919306..058c3b7 100644
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -18,7 +18,16 @@ else
PERF_BUILDID_DIR=$PERF_BUILDID_DIR/
fi
-BUILDIDS=$(mktemp /tmp/perf-archive-buildids.XXXXXX)
+#
+# PERF_TMP_DIR environment variable set by perf
+# path to temp directory, default to /tmp
+#
+if [ -z $PERF_TMP_DIR ]; then
+ PERF_TMP_DIR=/tmp
+fi
+
+
+BUILDIDS=$(mktemp $PERF_TMP_DIR/perf-archive-buildids.XXXXXX)
NOBUILDID=0000000000000000000000000000000000000000
perf buildid-list -i $PERF_DATA --with-hits | grep -v "^$NOBUILDID " > $BUILDIDS
@@ -28,7 +37,7 @@ if [ ! -s $BUILDIDS ] ; then
exit 1
fi
-MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
+MANIFEST=$(mktemp $PERF_TMP_DIR/perf-archive-manifest.XXXXXX)
PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
cut -d ' ' -f 1 $BUILDIDS | \
diff --git a/tools/perf/util/dso-test-data.c b/tools/perf/util/dso-test-data.c
index c6caede..ca81e65 100644
--- a/tools/perf/util/dso-test-data.c
+++ b/tools/perf/util/dso-test-data.c
@@ -18,7 +18,7 @@ do { \
static char *test_file(int size)
{
- static char buf_templ[] = "/tmp/test-XXXXXX";
+ static char buf_templ[] = PERF_TMP_DIR "/test-XXXXXX";
char *templ = buf_templ;
int fd, i;
unsigned char *buf;
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index b442ee4..c5b4632 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -59,7 +59,8 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
no_dso = is_no_dso_memory(filename);
if (anon) {
- snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
+ snprintf(newfilename, sizeof(newfilename),
+ PERF_TMP_DIR "/perf-%d.map", pid);
filename = newfilename;
}
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8a2229d..5ebde18 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -637,7 +637,7 @@ static char *test_format_dir_get(void)
static char dir[PATH_MAX];
unsigned int i;
- snprintf(dir, PATH_MAX, "/tmp/perf-pmu-test-format-XXXXXX");
+ snprintf(dir, PATH_MAX, PERF_TMP_DIR "/perf-pmu-test-format-XXXXXX");
if (!mkdtemp(dir))
return NULL;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e2e8c69..eb671d5 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1051,7 +1051,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
dso->adjust_symbols = 0;
- if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
+ if (strncmp(dso->name, PERF_TMP_DIR "/perf-", 10) == 0) {
struct stat st;
if (lstat(dso->name, &st) < 0)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index a8d81c3..e50ea61 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -481,7 +481,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
int temp_fd;
snprintf(tdata->temp_file, sizeof(tdata->temp_file),
- "/tmp/perf-XXXXXX");
+ PERF_TMP_DIR "/perf-XXXXXX");
if (!mkstemp(tdata->temp_file))
die("Can't make temp file");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 1/4] perf tools: configure tmp path at build time
2012-09-20 22:13 ` [PATCH 1/4] perf tools: configure tmp path at build time Irina Tirdea
@ 2012-09-21 7:47 ` Pekka Enberg
2012-09-21 13:05 ` David Ahern
0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2012-09-21 7:47 UTC (permalink / raw)
To: Irina Tirdea
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra, LKML, Paul Mackerras, David Ahern, Namhyung Kim,
Jiri Olsa, Irina Tirdea
Hi Irina,
On Fri, Sep 21, 2012 at 1:13 AM, Irina Tirdea <irina.tirdea@gmail.com> wrote:
> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
> index b442ee4..c5b4632 100644
> --- a/tools/perf/util/map.c
> +++ b/tools/perf/util/map.c
> @@ -59,7 +59,8 @@ struct map *map__new(struct list_head *dsos__list, u64 start, u64 len,
> no_dso = is_no_dso_memory(filename);
>
> if (anon) {
> - snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
> + snprintf(newfilename, sizeof(newfilename),
> + PERF_TMP_DIR "/perf-%d.map", pid);
> filename = newfilename;
> }
[snip]
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index e2e8c69..eb671d5 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1051,7 +1051,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
>
> dso->adjust_symbols = 0;
>
> - if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
> + if (strncmp(dso->name, PERF_TMP_DIR "/perf-", 10) == 0) {
> struct stat st;
>
> if (lstat(dso->name, &st) < 0)
Just to point out: these two path names are actually part of a
JIT/perf integration ABI. I'm OK with using PERF_TMP_DIR here but you
really ought to update tools/perf/Documentation/jit-interface.txt.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/4] perf tools: configure tmp path at build time
2012-09-21 7:47 ` Pekka Enberg
@ 2012-09-21 13:05 ` David Ahern
0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2012-09-21 13:05 UTC (permalink / raw)
To: Pekka Enberg, Irina Tirdea
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra, LKML, Paul Mackerras, Namhyung Kim, Jiri Olsa,
Irina Tirdea
On 9/21/12 1:47 AM, Pekka Enberg wrote:
>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
>> index e2e8c69..eb671d5 100644
>> --- a/tools/perf/util/symbol.c
>> +++ b/tools/perf/util/symbol.c
>> @@ -1051,7 +1051,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
>>
>> dso->adjust_symbols = 0;
>>
>> - if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
>> + if (strncmp(dso->name, PERF_TMP_DIR "/perf-", 10) == 0) {
>> struct stat st;
And, with "/tmp" as a variable the 10 in the strncmp might not be right.
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/4] perf tools: configure shell path at compile time
2012-09-20 22:13 [PATCH 0/4] perf: android: configure hardcoded paths Irina Tirdea
2012-09-20 22:13 ` [PATCH 1/4] perf tools: configure tmp path at build time Irina Tirdea
@ 2012-09-20 22:13 ` Irina Tirdea
2012-09-21 3:28 ` David Ahern
2012-09-20 22:13 ` [PATCH 3/4] perf annotate: configure objdump " Irina Tirdea
2012-09-20 22:13 ` [PATCH 4/4] perf tools: configure addr2line " Irina Tirdea
3 siblings, 1 reply; 10+ messages in thread
From: Irina Tirdea @ 2012-09-20 22:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra
Cc: LKML, Paul Mackerras, David Ahern, Namhyung Kim, Pekka Enberg,
Jiri Olsa, Irina Tirdea
From: Irina Tirdea <irina.tirdea@intel.com>
Shell path /bin/sh is hardcoded in various places in perf. Android has a
different folder structure and does not have /bin/sh.
Set the shell path at compile time in the Makefile by setting PERF_SHELL_PATH.
By default it is set to /bin/sh.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 6 +++++-
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-script.c | 12 ++++++------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index eab4a36..9021a1f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -828,7 +828,11 @@ $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFL
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
'-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
+ '-DPERF_INFO_PATH="$(infodir_SQ)"' \
+ '-DPERF_SHELL_DIR="/bin/sh"' $<
+
+$(OUTPUT)builtin-script.o: builtin-script.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_SHELL_DIR='"/bin/sh"' $<
$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25c8b94..a1d9703 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
{
struct strbuf shell_cmd = STRBUF_INIT;
strbuf_addf(&shell_cmd, "%s %s", cmd, page);
- execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
+ execl(PERF_SHELL_DIR, "sh", "-c", shell_cmd.buf, NULL);
warning("failed to exec '%s': %s", cmd, strerror(errno));
}
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 1be843a..4cc2c96 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1326,7 +1326,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
goto out;
}
- __argv[j++] = "/bin/sh";
+ __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = rec_script_path;
if (system_wide)
__argv[j++] = "-a";
@@ -1337,7 +1337,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
__argv[j++] = argv[i];
__argv[j++] = NULL;
- execvp("/bin/sh", (char **)__argv);
+ execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-1);
}
@@ -1353,7 +1353,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
}
j = 0;
- __argv[j++] = "/bin/sh";
+ __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = rep_script_path;
for (i = 1; i < rep_args + 1; i++)
__argv[j++] = argv[i];
@@ -1361,7 +1361,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
__argv[j++] = "-";
__argv[j++] = NULL;
- execvp("/bin/sh", (char **)__argv);
+ execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-1);
}
@@ -1390,7 +1390,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
goto out;
}
- __argv[j++] = "/bin/sh";
+ __argv[j++] = PERF_SHELL_DIR;
__argv[j++] = script_path;
if (system_wide)
__argv[j++] = "-a";
@@ -1398,7 +1398,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
__argv[j++] = argv[i];
__argv[j++] = NULL;
- execvp("/bin/sh", (char **)__argv);
+ execvp(PERF_SHELL_DIR, (char **)__argv);
free(__argv);
exit(-1);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 2/4] perf tools: configure shell path at compile time
2012-09-20 22:13 ` [PATCH 2/4] perf tools: configure shell path at compile time Irina Tirdea
@ 2012-09-21 3:28 ` David Ahern
0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2012-09-21 3:28 UTC (permalink / raw)
To: Irina Tirdea
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra, LKML, Paul Mackerras, Namhyung Kim, Pekka Enberg,
Jiri Olsa, Irina Tirdea
On 9/20/12 4:13 PM, Irina Tirdea wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
>
> Shell path /bin/sh is hardcoded in various places in perf. Android has a
> different folder structure and does not have /bin/sh.
>
> Set the shell path at compile time in the Makefile by setting PERF_SHELL_PATH.
> By default it is set to /bin/sh.
code change below uses PERF_SHELL_DIR; it's not a directory so
PERF_SHELL_PATH per the above comment is better.
David
>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> ---
> tools/perf/Makefile | 6 +++++-
> tools/perf/builtin-help.c | 2 +-
> tools/perf/builtin-script.c | 12 ++++++------
> 3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index eab4a36..9021a1f 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -828,7 +828,11 @@ $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFL
> $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
> '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
> '-DPERF_MAN_PATH="$(mandir_SQ)"' \
> - '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
> + '-DPERF_INFO_PATH="$(infodir_SQ)"' \
> + '-DPERF_SHELL_DIR="/bin/sh"' $<
> +
> +$(OUTPUT)builtin-script.o: builtin-script.c $(OUTPUT)PERF-CFLAGS
> + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_SHELL_DIR='"/bin/sh"' $<
>
> $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
> $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
> diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
> index 25c8b94..a1d9703 100644
> --- a/tools/perf/builtin-help.c
> +++ b/tools/perf/builtin-help.c
> @@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
> {
> struct strbuf shell_cmd = STRBUF_INIT;
> strbuf_addf(&shell_cmd, "%s %s", cmd, page);
> - execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
> + execl(PERF_SHELL_DIR, "sh", "-c", shell_cmd.buf, NULL);
> warning("failed to exec '%s': %s", cmd, strerror(errno));
> }
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 1be843a..4cc2c96 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -1326,7 +1326,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> goto out;
> }
>
> - __argv[j++] = "/bin/sh";
> + __argv[j++] = PERF_SHELL_DIR;
> __argv[j++] = rec_script_path;
> if (system_wide)
> __argv[j++] = "-a";
> @@ -1337,7 +1337,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> __argv[j++] = argv[i];
> __argv[j++] = NULL;
>
> - execvp("/bin/sh", (char **)__argv);
> + execvp(PERF_SHELL_DIR, (char **)__argv);
> free(__argv);
> exit(-1);
> }
> @@ -1353,7 +1353,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> }
>
> j = 0;
> - __argv[j++] = "/bin/sh";
> + __argv[j++] = PERF_SHELL_DIR;
> __argv[j++] = rep_script_path;
> for (i = 1; i < rep_args + 1; i++)
> __argv[j++] = argv[i];
> @@ -1361,7 +1361,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> __argv[j++] = "-";
> __argv[j++] = NULL;
>
> - execvp("/bin/sh", (char **)__argv);
> + execvp(PERF_SHELL_DIR, (char **)__argv);
> free(__argv);
> exit(-1);
> }
> @@ -1390,7 +1390,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> goto out;
> }
>
> - __argv[j++] = "/bin/sh";
> + __argv[j++] = PERF_SHELL_DIR;
> __argv[j++] = script_path;
> if (system_wide)
> __argv[j++] = "-a";
> @@ -1398,7 +1398,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
> __argv[j++] = argv[i];
> __argv[j++] = NULL;
>
> - execvp("/bin/sh", (char **)__argv);
> + execvp(PERF_SHELL_DIR, (char **)__argv);
> free(__argv);
> exit(-1);
> }
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] perf annotate: configure objdump path at compile time
2012-09-20 22:13 [PATCH 0/4] perf: android: configure hardcoded paths Irina Tirdea
2012-09-20 22:13 ` [PATCH 1/4] perf tools: configure tmp path at build time Irina Tirdea
2012-09-20 22:13 ` [PATCH 2/4] perf tools: configure shell path at compile time Irina Tirdea
@ 2012-09-20 22:13 ` Irina Tirdea
2012-09-21 0:17 ` Namhyung Kim
2012-09-20 22:13 ` [PATCH 4/4] perf tools: configure addr2line " Irina Tirdea
3 siblings, 1 reply; 10+ messages in thread
From: Irina Tirdea @ 2012-09-20 22:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra
Cc: LKML, Paul Mackerras, David Ahern, Namhyung Kim, Pekka Enberg,
Jiri Olsa, Irina Tirdea
From: Irina Tirdea <irina.tirdea@intel.com>
The default name for objdump is "objdump". For cross-compiling the name of
objdump will be different (e.g. arm-eabi-objdump in Android).
Setting the default objdump name in the Makefile with PERF_OBJDUMP_PATH.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 4 ++++
tools/perf/util/annotate.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9021a1f..3d28150 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -140,6 +140,7 @@ ETC_PERFCONFIG = etc/perfconfig
endif
lib = lib
PERF_TMP_DIR = /tmp
+objdump = objdump
export prefix bindir sharedir sysconfdir
@@ -883,6 +884,9 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
'-DPREFIX="$(prefix_SQ)"' \
$<
+$(OUTPUT)util/annotate.o: util/annotate.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_OBJDUMP_PATH='"$(objdump)"' $<
+
$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index f0a9103..a45ac77 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -824,7 +824,7 @@ fallback:
"%s %s%s --start-address=0x%016" PRIx64
" --stop-address=0x%016" PRIx64
" -d %s %s -C %s|grep -v %s|expand",
- objdump_path ? objdump_path : "objdump",
+ objdump_path ? objdump_path : PERF_OBJDUMP_PATH,
disassembler_style ? "-M " : "",
disassembler_style ? disassembler_style : "",
map__rip_2objdump(map, sym->start),
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] perf annotate: configure objdump path at compile time
2012-09-20 22:13 ` [PATCH 3/4] perf annotate: configure objdump " Irina Tirdea
@ 2012-09-21 0:17 ` Namhyung Kim
0 siblings, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2012-09-21 0:17 UTC (permalink / raw)
To: Irina Tirdea
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra, LKML, Paul Mackerras, David Ahern, Pekka Enberg,
Jiri Olsa, Irina Tirdea
Hi Irina,
On Fri, 21 Sep 2012 01:13:34 +0300, Irina Tirdea wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
>
> The default name for objdump is "objdump". For cross-compiling the name of
> objdump will be different (e.g. arm-eabi-objdump in Android).
>
> Setting the default objdump name in the Makefile with PERF_OBJDUMP_PATH.
Not a big deal, but how about DEFAULT_OBJDUMP_PATH?
>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> ---
> tools/perf/Makefile | 4 ++++
> tools/perf/util/annotate.c | 2 +-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 9021a1f..3d28150 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -140,6 +140,7 @@ ETC_PERFCONFIG = etc/perfconfig
> endif
> lib = lib
> PERF_TMP_DIR = /tmp
> +objdump = objdump
More usual pattern would be
OBJDUMP = $(CROSS_COMPILE)objdump
? And it'd more fit to the description.
Thanks,
Namhyung
>
> export prefix bindir sharedir sysconfdir
>
> @@ -883,6 +884,9 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
> '-DPREFIX="$(prefix_SQ)"' \
> $<
>
> +$(OUTPUT)util/annotate.o: util/annotate.c $(OUTPUT)PERF-CFLAGS
> + $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_OBJDUMP_PATH='"$(objdump)"' $<
> +
> $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
> $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index f0a9103..a45ac77 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -824,7 +824,7 @@ fallback:
> "%s %s%s --start-address=0x%016" PRIx64
> " --stop-address=0x%016" PRIx64
> " -d %s %s -C %s|grep -v %s|expand",
> - objdump_path ? objdump_path : "objdump",
> + objdump_path ? objdump_path : PERF_OBJDUMP_PATH,
> disassembler_style ? "-M " : "",
> disassembler_style ? disassembler_style : "",
> map__rip_2objdump(map, sym->start),
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] perf tools: configure addr2line path at compile time
2012-09-20 22:13 [PATCH 0/4] perf: android: configure hardcoded paths Irina Tirdea
` (2 preceding siblings ...)
2012-09-20 22:13 ` [PATCH 3/4] perf annotate: configure objdump " Irina Tirdea
@ 2012-09-20 22:13 ` Irina Tirdea
2012-09-21 0:19 ` Namhyung Kim
3 siblings, 1 reply; 10+ messages in thread
From: Irina Tirdea @ 2012-09-20 22:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra
Cc: LKML, Paul Mackerras, David Ahern, Namhyung Kim, Pekka Enberg,
Jiri Olsa, Irina Tirdea
From: Irina Tirdea <irina.tirdea@intel.com>
The default name for addr2line is hardcoded to "addr2line".
When cross-compiling the name of addr2line will be different
(e.g. arm-eabi-addr2line in Android).
Setting the default addr2line name in the Makefile with PERF_ADDR2LINE_PATH.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
tools/perf/Makefile | 6 +++++-
tools/perf/util/annotate.c | 3 ++-
tools/perf/util/sort.c | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3d28150..1851884 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -141,6 +141,7 @@ endif
lib = lib
PERF_TMP_DIR = /tmp
objdump = objdump
+addr2line = addr2line
export prefix bindir sharedir sysconfdir
@@ -885,7 +886,7 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
$<
$(OUTPUT)util/annotate.o: util/annotate.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_OBJDUMP_PATH='"$(objdump)"' $<
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_OBJDUMP_PATH='"$(objdump)"' -DPERF_ADDR2LINE_PATH='"$(addr2line)"' $<
$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
@@ -896,6 +897,9 @@ $(OUTPUT)util/dso-test-data.o: util/dso-test-data.c $(OUTPUT)PERF-CFLAGS
$(OUTPUT)util/map.o: util/map.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
+$(OUTPUT)util/sort.o: util/sort.c $(OUTPUT)PERF-CFLAGS
+ $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_ADDR2LINE_PATH='"$(addr2line)"' $<
+
$(OUTPUT)util/symbol.o: util/symbol.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_TMP_DIR='"$(PERF_TMP_DIR)"' $<
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index a45ac77..b20b418 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -915,7 +915,8 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
continue;
offset = start + i;
- sprintf(cmd, "addr2line -e %s %016" PRIx64, filename, offset);
+ sprintf(cmd, PERF_ADDR2LINE_PATH " -e %s %016" PRIx64, filename,
+ offset);
fp = popen(cmd, "r");
if (!fp)
continue;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b5b1b92..f00619c 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -260,7 +260,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
if (path != NULL)
goto out_path;
- snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
+ snprintf(cmd, sizeof(cmd), PERF_ADDR2LINE_PATH" -e %s %016" PRIx64,
self->ms.map->dso->long_name, self->ip);
fp = popen(cmd, "r");
if (!fp)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 4/4] perf tools: configure addr2line path at compile time
2012-09-20 22:13 ` [PATCH 4/4] perf tools: configure addr2line " Irina Tirdea
@ 2012-09-21 0:19 ` Namhyung Kim
0 siblings, 0 replies; 10+ messages in thread
From: Namhyung Kim @ 2012-09-21 0:19 UTC (permalink / raw)
To: Irina Tirdea
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Steven Rostedt,
Peter Zijlstra, LKML, Paul Mackerras, David Ahern, Pekka Enberg,
Jiri Olsa, Irina Tirdea
On Fri, 21 Sep 2012 01:13:35 +0300, Irina Tirdea wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
>
> The default name for addr2line is hardcoded to "addr2line".
> When cross-compiling the name of addr2line will be different
> (e.g. arm-eabi-addr2line in Android).
>
> Setting the default addr2line name in the Makefile with PERF_ADDR2LINE_PATH.
Please see my previous reply to PATCH 3/4. It also applies here.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 10+ messages in thread