From: Jeff Sullivan <jps@zk3.dec.com>
Subject: Re: PATGEN performance problem on Digital UNIX
Date: 2000/03/21 [thread overview]
Message-ID: <38D79963.420E8897@zk3.dec.com> (raw)
In-Reply-To: 8atbr0$ao7$1@news.tue.nl
This looks like a source code problem in the patgen problem.
What is happening is that the stack is being corrupted by a
call to the null_terminate routine. A later call to exit()
ends up in an rendom loop doing "free"s of bad addresses.
This loop is what is consuming most of the time in the bad
case.
I used atom third degree (see man atom, man third) to diagnose
the memory overwrite. This is what it told me when I ran it:
strpascal.c: 25: reading invalid heap at 0x140460000
null_terminate patgen, strpascal.c, line 25
make_c_string patgen, strpascal.c, line 15
xfopen_pas patgen, xfopen-pas.c, line 15
dodictionary patgen, patgen2.c, line 1398
main_body patgen, patgen2.c, line 1698
main patgen, main.c, line 30
__start patgen
When I ran this in the debugger, I found that there were many
calls to make_c_string and did not quickly find where the problem
was occuring.
However, when I made a simple "debugging" change to null_terminate.
I saw this (bad) case:
null_terminate: s=pattmp.5, len=8
null_terminate: i=528
In a "good" case, I expect that i would be len-1. It
certainly is not in this case.
The debugging change I made to null_terminate was this:
int i = 0;
printf("null_terminate: s=%s, len=%d\n", s, strlen(s));
while (*s != ' ')
{ s++; i++; }
printf("null_terminate: i=%d\n", i);
In the (bad) case of pattmp.5, it looks like the string does
NOT have a trailing space and the null_terminate function will
add the NULL termination to some unknown location. It may
sometimes work, but it looks like a source code bug to me.
Let me know if this helps.
Thanks,
-Jeff
--
Jeff Sullivan | Compaq Computer Corp. | mailto:jps@zk3.dec.com
Compaq C/C++ | Nashua, NH 03062-2698 | Jeff.Sullivan@compaq.com
next prev parent reply other threads:[~2000-03-21 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-17 5:00 PATGEN performance problem on Digital UNIX Piet Tutelaers
2000-03-20 5:00 ` Jeff Sullivan
2000-03-21 5:00 ` Jeff Sullivan [this message]
2000-03-31 5:00 ` Piet Tutelaers
2000-03-31 5:00 ` Donald Arseneau
2000-03-31 5:00 ` Piet Tutelaers
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox