Skip to contentSkip to conversation

perf map: Use map->prot in place of type==MAP__FUNCTION

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 2, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  d183b2614fcd6d0a10c792891fd09bb254594ad4
Gitweb:     https://git.kernel.org/tip/d183b2614fcd6d0a10c792891fd09bb254594ad4
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 26 Apr 2018 16:08:38 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 26 Apr 2018 16:08:38 -0300

perf map: Use map->prot in place of type==MAP__FUNCTION

Equivalent, one step more in ditching enum map_type.

---
 tools/perf/util/map.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/map.c +2 -2
index ab12f2bc7669..a164e1ed5462 100644
@@ -173,7 +173,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
 		map->flags = flags;
 		nsi = nsinfo__get(thread->nsinfo);
 
-		if ((anon || no_dso) && nsi && type == MAP__FUNCTION) {
+		if ((anon || no_dso) && nsi && (prot & PROT_EXEC)) {
 			snprintf(newfilename, sizeof(newfilename),
 				 "/tmp/perf-%d.map", nsi->pid);
 			filename = newfilename;
@@ -213,7 +213,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
 			 * functions still return NULL, and we avoid the
 			 * unnecessary map__load warning.
 			 */
-			if (type != MAP__FUNCTION)
+			if (!(prot & PROT_EXEC))
 				dso__set_loaded(dso, map->type);
 		}
 		dso->nsinfo = nsi;