Re: silly [< >] and other excess

Albert D. Cahalan
2000-11-23T13:09:48Z

Keith Owens writes:
> "Albert D. Cahalan" <acahalan@cs.uml.edu> wrote:

>> The hard part of klogd/ksymoops is decoding the code bytes AFAIK.
>> The rest is a just a cross between grep and ps -- you search and
>> you do symbol lookups. I could throw it together in a few hours,
>> minus the disassembly part.
>
> Take a look at the code in ksymoops oops.c before you make rash
> statements like that. It has to handle _all_ architecture messages,
> including cross arch debugging.

I looked. I'm sure that was hard to write, but I don't agree
that it is needed. If you miss one of the zillions of kernel
data formats, then you can't properly handle the data.

Also, cross-arch debugging is done by people who don't need tools
like ksymoops anyway. Most likely they have half the opcodes
memorized already, and they have the CPU manual open on their desk.
Tools are needed so that regular users don't have to send the
whole System.map file to linux-kernel.

I threw together a semi-working prototype in a few hours.
It is the worst code I ever wrote in my life, not even
excluding stuff I wrote in Atari BASIC. It slurps down log
files pretty well though, and proves "[<>]" is unneeded.

Nasty source:
http://www.cs.uml.edu/~acahalan/linux/ogrep.tar.gz

Compile:
gcc -O2 -DOGREP -o ogrep *.c

Example usage:
ogrep -v 2.2.11 parser-god-sacrifice your-log-file

Um, yeah, you have to sacrifice an argument to the parser gods.
The built-in usage message is thus wrong. The ksyms parser is
disabled, you get some extra blank lines, and invalid symbols
print as "?" (the ps WCHAN behavior) instead of being suppressed.
Non-i386 ought to work, provided that kernel pointers are not
wider than usespace pointers. Performance needs work too.

While the code is crap, it does prove that you don't need
kernel code to put silly [<>] brackets around anything.