From: fred <fred> Date: Sun, 24 Mar 2002 20:13:07 +0000 (+0000) Subject: lilypond-1.0.1 X-Git-Tag: release/1.5.59~3019 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ffbaf2849c05405ada8033d33644877413f17dff;p=lilypond.git lilypond-1.0.1 --- diff --git a/lily/debug.cc b/lily/debug.cc index 8fcb8eba4b..200af4ec32 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1996,98 Han-Wen Nienhuys <hanwen@stack.nl> + (c) 1996,98 Han-Wen Nienhuys <hanwen@cs.uu.nl> */ #include <fstream.h> @@ -12,12 +12,15 @@ // libg++ 2.8.0 // #include <std/new.h> #include <stdlib.h> + + #include "debug.hh" #include "dstream.hh" #include "flower-debug.hh" #include "moment.hh" - +#include "misc.hh" #include "main.hh" + Dstream *monitor=0; ostream * nulldev =0; @@ -50,7 +53,7 @@ mynewhandler() void float_handler (int) { - cerr << _("Floating point exception .. \n")<< flush; + cerr << _ ("Floating point exception") << endl; assert (false); } @@ -72,30 +75,54 @@ bool check_debug=false; bool check_malloc_b = false; -//#define MEMORY_PARANOID +// #define MEMORY_PARANOID #ifdef MEMORY_PARANOID #include <malloc.h> +void +frobnify (void *p, size_t s) +{ + char *cp = (char*)p; + char *e = cp + s; + while (cp < e) + { + *cp++ ^=42; + } +} + + void * operator new (size_t size) { void *result; result = malloc (size); if (check_malloc_b) - memfrob (result, size); + frobnify (result, size); return result; } +void *to_frob; int frob_size; + +void +set_frobnify (void * p, size_t sz) +{ + to_frob = p; + frob_size = sz; +} void operator delete (void *p) { if (!p) return ; - if (check_malloc_b) - memfrob (p, 8); // ugh. Need the blocksize. 8 is sysdependant + if (p == to_frob) + { + frobnify (p, frob_size); + to_frob = 0; + frob_size=0; + } free (p); } @@ -106,11 +133,10 @@ set_debug (bool b) { check_debug =b; set_flower_debug (*monitor, check_debug); - check_malloc_b = experimental_features_global_b; #ifdef MEMORY_PARANOID if (check_malloc_b) if (mcheck (0)) - warning ("Can't set mem-checking!"); + warning (_ ("can't set mem-checking") + "!"); #endif }