[m-rev.] diff: reduce the size of debug-grade .c files
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Mar 10 17:34:38 AEDT 2004
On 10-Mar-2004, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Not only. It is also for general purpose use, e.g.
>
> nm libfoo.so | mdemangle | less
>
> which can be useful when analyzing space usage.
I guess, though anyone who would want to do that doesn't need the demangler.
> > util/mdemangle.c has never had
> > any code to recognize their names; there is no recognition code to update.
>
> What about the code at the "not_plain_mercury:" label in demangle()?
I modified to to recognize the new names of common structures. There is
no code to recognize any part of label layouts.
Zoltan.
util/mdemangle.c:
Recognize the new style names of common structures.
Document a limitation of a function.
cvs diff: Diffing .
Index: mdemangle.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/mdemangle.c,v
retrieving revision 1.48
diff -u -b -r1.48 mdemangle.c
--- mdemangle.c 17 Jan 2003 05:57:20 -0000 1.48
+++ mdemangle.c 10 Mar 2004 06:30:30 -0000
@@ -173,6 +173,7 @@
static const char ho_suffix[] = "__ho"; /* added by higher_order.m */
+ static const char mercury_common[] = "mercury_common_";
static const char mercury_data[] = "mercury_data_";
static const char type_ctor_layout[] = "type_ctor_layout_";
static const char type_ctor_info[] = "type_ctor_info_";
@@ -677,6 +678,14 @@
start++;
}
+ if (strip_prefix(&start, mercury_common)) {
+ if (!strip_leading_integer(&start, &arity)) {
+ goto wrong_format;
+ }
+ printf("<shared constant number %d>", arity);
+ return;
+ }
+
if (strip_prefix(&start, mercury_data)) {
/* LLDS */
high_level = MR_FALSE;
@@ -972,6 +981,8 @@
** is returned if there is an integer at the end, false if not.
** If false is returned, the string will not be cut.
** `real_end' is updated with the new end of the string
+ ** Requires *str to contain more than just a number; doesn't work
+ ** if the trailing integer starts at the first character of str.
*/
static MR_bool
cut_trailing_integer(char *str, char **real_end, int *num)
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list