From ef98d5ac064fde1ac8467067fbc639b9d84dfd17 Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Sun, 21 Jul 1991 13:02:48 +0000 Subject: Mostly MIPS symbol-reading and general symbol-reading fixups. --- gdb/mtrace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gdb/mtrace.c') diff --git a/gdb/mtrace.c b/gdb/mtrace.c index 06268c4..82e7f03 100755 --- a/gdb/mtrace.c +++ b/gdb/mtrace.c @@ -118,14 +118,19 @@ DEFUN(tr_reallochook, (ptr, size), PTR ptr AND size_t size) return hdr; } +/* We enable tracing if either the environment variable MALLOC_TRACE + is set, or if the variable mallwatch has been patched to an address + that the debugging user wants us to stop on. When patching mallwatch, + don't forget to set a breakpoint on tr_break! */ + void mtrace() { char *mallfile; mallfile = getenv (mallenv); - if (mallfile) { - mallstream = fopen (mallfile, "w"); + if (mallfile || mallwatch) { + mallstream = fopen (mallfile? mallfile: "/dev/null", "w"); if (mallstream) { /* Be sure it doesn't malloc its buffer! */ setbuf (mallstream, mallbuf); -- cgit v1.1