daemon@tut.cis.ohio-state.edu (Admin) (10/14/88)
These all refer to gdb 2.7.
When stepping, if you enter a function with a null prolog, it
stops at the second line instead of the first. If it doesn't have
line numbers, gdb goes on stepping for a long time, maybe forever.
Fix: in infrun.c routine wait_for_inferior, after
if (newfun_pc == stop_pc)
/* We are already there: stop now. */
stop_step = 1;
add
break;
(and some braces)
---
"print/fmt *first@len" prints only the first element
Fix: in printcmd.c routine print_formatted, after
default:
if (format == 0
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_ARRAY
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRUCT
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_UNION
add
|| VALUE_REPEATED (val))
---
char parameters are promoted to ints at the same address; the
address needs to be adjusted on a big endian machine.
Fix is in dbxread.c routine define_symbol near
/* If PCC says a parameter is a short or a char,
it is really an int. */
if (SYMBOL_TYPE (sym) == builtin_type_char
|| SYMBOL_TYPE (sym) == builtin_type_short)
My fix is not portable, but it's something like
SYMBOL_VALUE (sym) -= sizeof (int) - TYPE_LENGTH (SYMBOL_TYPE (sym));
in two places.
---
the type of x in
float (*x)[10]
prints correctly as float (*)[], but the type of x in
float (*x)[10][10]
prints as
float (*[])[]
which is wrong.
I think fixing this would require major surgery in type_print.
(That's the type of Fortran array parameters, and this one led me
on a wild goose chase once, which is the reason I mention it.
Don't be fooled...)
---
and here's a suggested enhancement: a command for the bottom of loops
to proceed to the next line after the loop. Or to proceed to a
specified place, with the same arg syntax as the break command.
/* "proceed": Set a momentary breakpoint at the specified line,
or the following line if none is specified, then continue.
Same arg syntax as break. */
static void
proceed_command (arg, from_tty)
char *arg;
int from_tty;
{
struct symtab_and_line sal;
register FRAME frame;
if (!have_inferior_p ())
error ("The program is not being run.");
clear_proceed_status ();
if (arg)
{
sal = decode_line_1 (&arg, 1, 0, 0);
if (*arg)
error ("Junk at end of arguments.");
if (sal.pc == 0 && sal.symtab != 0)
sal.pc = find_line_pc (sal.symtab, sal.line);
}
else
{
struct frame_info fi;
fi = get_frame_info (selected_frame);
sal = find_pc_line (fi.pc, fi.next_frame);
if (sal.symtab == 0)
error ("Current function has no line number information.");
sal.line += 1;
sal.pc = find_line_pc (sal.symtab, sal.line);
step_frame = fi.frame;
}
if (sal.pc == 0)
error ("No line %d in file \"%s\".", sal.line, sal.symtab->filename);
set_momentary_breakpoint (sal, 0);
proceed (-1, -1, 0);
}
in initialize ():
add_com ("proceed", class_run, proceed_command,
"Execute until the program reaches the next source line\n\
or a specified line or address or function (same args as break command).");
To be pretty, this needs to set a variable for infrun to look at,
to cause normal_stop to print just source when the momentary
breakpoint gets hit (unless stop_frame changed). I used
proceed_to_pc = sal.pc;
set along with step_frame in proceed_command and checked in normal_stop.