Subject: Re: bin/8681: grep may bomb out with "memory exhausted"
To: Simon Burge <simonb@NetBSD.ORG>
From: Todd Whitesel <toddpw@best.com>
List: netbsd-bugs
Date: 10/29/1999 01:20:43
> Unfortunately, some debugging kernels seem to have this behaviour.

It isn't just debugging kernels. Any large program with debugging will
trigger this. The real issue here is grepping in debug binaries.

One of the things -g adds to your program is a section containing a huge
block of null-terminated strings. The "real" debug info section is made
up of mostly fixed-length structs, which do not embed strings but instead
use relocated offsets pointing into the strings section. This is how the
debugger prints out your file/function/variable names even when they are
hundreds of characters long (like with C++ templates).

The strings section does not contain any of your program's literal string
constants, so there's not much chance of a newline ever appearing there.

Todd Whitesel
toddpw @ best.com