Subject: Re: GDB busted, what did I do to deserve this?
To: Craig M. Chase <>
From: Open Carefully -- Contents Under Pressure <>
List: current-users
Date: 11/15/1995 10:00:16
#define AUTHOR " ("Craig M. Chase")"

 * Well, it has been about two weeks, and I've not seen anybody else
 * complain, so I must conclude that I am the only person with this
 * malady, and that I have somehow inflicted this pain on myself.
 * gdb broke thoroughly around about the start of November when I
 * upgraded to a NetBSD-1.1ALPHA (i386) kernel and system.
 * I have two Pentium systems that are suffering from this problem.
 * The synopsis:
 * chase@orac>/usr/bin/cc -g -static -o hello hello.c
 * chase@orac>/usr/bin/gdb hello
 * GDB is free software and you are welcome to distribute copies of it
 *  under certain conditions; type "show copying" to see the conditions.
 * There is absolutely no warranty for GDB; type "show warranty" for details.
 * GDB 4.11 (i386-netbsd), Copyright 1993 Free Software Foundation, Inc...
 * (gdb) break main
 * Breakpoint 1 at 0x1098: file hello.c, line 5.
 * (gdb) run
 * Starting program: /a/orac/home/orac/chase/src/hello 
 * Breakpoint 1, main () at hello.c:5
 * 5               printf("hello world\n");
 * (gdb) n
 * Program received signal SIGSEGV (11), Segmentation fault
 * 0x1099 in main () at hello.c:5

Just a guess, but I would say that the "0x1099" is a good sign that
something is quite amiss.

I didn't think an x86 processor was capable of executing instructions
based at unaligned addresses, although I'm not sure of what constitutes
an unaligned address.  I would suspect that x86 stuff is at least word-
aligned, if not long-aligned.

Now, if you run the program by itself, does it still dump core?

I have no idea *why* gdb would fail here as I am not a compiler/debugger
type person, but it would appear that it's trying to literally "single-
step" (i.e. address-at-a-time-in-increments-of-one-which-unfortunately-
are-not-longword-or-word-aligned) through the program.

I'm hoping that this attempted guess at useful information might tip off a
more knowledgeable debugger/compiler type person.

 * 5               printf("hello world\n");
 * (gdb) print "ARRRRHHGGGG!"
 * Program received signal SIGSEGV (11), Segmentation fault
 * 0x1099 in main () at hello.c:5
 * 5               printf("hello world\n");
 * The program being debugged stopped while in a function called from GDB.
 * When the function (malloc) is done executing, GDB will silently
 * stop (instead of continuing to evaluate the expression containing
 * the function call).
 * (gdb) quit
 * The program is running.  Quit anyway (and kill it)? (y or n) y

#undef AUTHOR	/* " ("Craig M. Chase")" */

Friends don't let friends use System V.