aboutsummaryrefslogtreecommitdiff
path: root/gdb/mtrace.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-07-21 13:02:48 +0000
committerJohn Gilmore <gnu@cygnus>1991-07-21 13:02:48 +0000
commitef98d5ac064fde1ac8467067fbc639b9d84dfd17 (patch)
treeeba27af98fb721b83cfd7319845cb615905688a9 /gdb/mtrace.c
parenteb752e4e4efce02ce4a86fc4e5a8278d65e844b8 (diff)
downloadbinutils-ef98d5ac064fde1ac8467067fbc639b9d84dfd17.zip
binutils-ef98d5ac064fde1ac8467067fbc639b9d84dfd17.tar.gz
binutils-ef98d5ac064fde1ac8467067fbc639b9d84dfd17.tar.bz2
Mostly MIPS symbol-reading and general symbol-reading fixups.
Diffstat (limited to 'gdb/mtrace.c')
-rwxr-xr-xgdb/mtrace.c9
1 files changed, 7 insertions, 2 deletions
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);