From 63cd419876d64ed916be1b2246505f103ce39b06 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Wed, 23 Jul 2003 19:24:31 +0000 Subject: [PATCH] 2003-07-23 Michal Ludvig Elena Zannoni * linespec.c (decode_line_2): Avoid crash if find_function_start_sal() returns empty record. --- gdb/ChangeLog | 6 ++++++ gdb/linespec.c | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 028ae51ad81..ac7e94397ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-07-23 Michal Ludvig + Elena Zannoni + + * linespec.c (decode_line_2): Avoid crash if + find_function_start_sal() returns empty record. + 2003-07-23 Andreas Schwab * ia64-tdep.c (ia64_print_insn): New function. diff --git a/gdb/linespec.c b/gdb/linespec.c index b8f727453ea..4b863ef8f74 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -483,11 +483,18 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline, if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK) { values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline); - printf_unfiltered ("[%d] %s at %s:%d\n", - (i + 2), - SYMBOL_PRINT_NAME (sym_arr[i]), - values.sals[i].symtab->filename, - values.sals[i].line); + if (values.sals[i].symtab) + printf_unfiltered ("[%d] %s at %s:%d\n", + (i + 2), + SYMBOL_PRINT_NAME (sym_arr[i]), + values.sals[i].symtab->filename, + values.sals[i].line); + else + printf_unfiltered ("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n", + (i + 2), + SYMBOL_PRINT_NAME (sym_arr[i]), + values.sals[i].line); + } else printf_unfiltered ("?HERE\n"); -- 2.30.2