[m-dev.] for review: add option --no-demangle to profiler

Peter Ross peter.ross at miscrit.be
Tue Aug 1 19:47:55 AEST 2000


Hi,


===================================================================


Estimated hours taken: 1

Add the option --no-demangle to the profiler.
This option is needed so that I can debug memory profiling in the hlc
grades.

profiler/options.m:
    Document the new option.

profiler/read.m:
    Check the option before demangling label names.


Index: options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/options.m,v
retrieving revision 1.13
diff -u -r1.13 options.m
--- options.m	1997/12/05 15:55:50	1.13
+++ options.m	2000/08/01 09:45:01
@@ -31,6 +31,7 @@
 		;	pairfile
 		;	declfile
 		;	libraryfile
+		;	demangle
 	% Miscellaneous Options
 		;	help.
 
@@ -75,6 +76,7 @@
 option_default(pairfile,		string("Prof.CallPair")).
 option_default(declfile,		string("Prof.Decl")).
 option_default(libraryfile,		string("")).
+option_default(demangle,		bool(yes)).
 
 	% Miscellaneous Options
 option_default(help,		bool(no)).
@@ -99,6 +101,7 @@
 long_option("call-graph",		call_graph).
 long_option("count-file",		countfile).
 long_option("declaration-file",		declfile).
+long_option("demangle",			demangle).
 long_option("help",			help).
 long_option("library-callgraph",	help).
 long_option("profile",			profile).
@@ -166,6 +169,8 @@
 	io__write_string("\t-L <file>, --library-callgraph <file>\n"),
 	io__write_string("\t\tName of the file which contains the call graph for\n"),
 	io__write_string("\t\tthe library modules.\n"),
+	io__write_string("\t--no-demangle\n"),
+	io__write_string("\t\tOuput the unmangled predicate and function names.\n"),
 
 
 	io__write_string("\nVerbosity Options:\n"),
Index: read.m
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/read.m,v
retrieving revision 1.9
diff -u -r1.9 read.m
--- read.m	1998/03/04 19:59:56	1.9
+++ read.m	2000/08/01 09:45:01
@@ -50,10 +50,10 @@
 
 :- implementation.
 
-:- import_module list, char.
+:- import_module bool, list, char.
 :- import_module require.
 
-:- import_module demangle.
+:- import_module demangle, options.
 
 %-----------------------------------------------------------------------------%
 
@@ -93,12 +93,19 @@
 
 
 maybe_read_label_name(MaybeLabelName) -->
+	globals__io_lookup_bool_option(demangle, Demangle),
 	io__read_word(WordResult),
 	(
 		{ WordResult = ok(CharList0) },
-		{ string__from_char_list(CharList0, LabelName0) },
-		{ demangle(LabelName0, LabelName) },
-		{ MaybeLabelName = yes(LabelName) }
+		{ string__from_char_list(CharList0, MangledLabelName) },
+		(
+			{ Demangle = yes },
+			{ demangle(MangledLabelName, LabelName) },
+			{ MaybeLabelName = yes(LabelName) }
+		;
+			{ Demangle= no },
+			{ MaybeLabelName = yes(MangledLabelName) }
+		)
 	;
 		{ WordResult = eof },
 		{ MaybeLabelName = no }
@@ -145,11 +152,18 @@
 %-----------------------------------------------------------------------------%
 
 read_label_name(LabelName) -->
+	globals__io_lookup_bool_option(demangle, Demangle),
 	io__read_word(WordResult),
 	(
 		{ WordResult = ok(CharList0) },
-		{ string__from_char_list(CharList0, LabelName0) },
-		{ demangle(LabelName0, LabelName) }
+		{ string__from_char_list(CharList0, MangledLabelName) },
+		(
+			{ Demangle = yes },
+			{ demangle(MangledLabelName, LabelName) }
+		;
+			{ Demangle= no },
+			{ LabelName = MangledLabelName }
+		)
 	;
 		{ WordResult = eof },
 		{ error("read_label_name: EOF reached") }

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list