aboutsummaryrefslogtreecommitdiff
path: root/gdb/hpread.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-03-29 23:29:47 +0000
committerAndrew Cagney <cagney@redhat.com>2003-03-29 23:29:47 +0000
commit65e82032f23f19b38aaf89a1eaddfeec68b8c076 (patch)
treea3f1837f24d55d69c188464301c29edb5f27c3d4 /gdb/hpread.c
parent2c3bbe771ad9c73a4b4cc2e5bb2886b1ce55891b (diff)
downloadgdb-65e82032f23f19b38aaf89a1eaddfeec68b8c076.zip
gdb-65e82032f23f19b38aaf89a1eaddfeec68b8c076.tar.gz
gdb-65e82032f23f19b38aaf89a1eaddfeec68b8c076.tar.bz2
2003-03-29 Andrew Cagney <cagney@redhat.com>
* infttrace.h: New file. * hpread.c: Include "gdb_assert.h" and "somsolib.h". (hpread_get_textlow): Detect an uninitialized dn_bufp. (hpread_read_doc_function_type): Detect an initialized type1. (hpread_quick_traverse): Initialize mod_name_string. * somsolib.h: Add #ifdef SOMSOLIB_H wrapper. (som_solib_get_solib_by_pc): Declare. (so_lib_thread_start_addr): Declare. (no_shared_libraries): Declare. * somread.c (init_import_symbols): Make static. Add forward declaration. * config/pa/nm-hppah.h: Include "infttrace.h" for parent_attach_all. (hppa_insert_hw_watchpoint): Declare. (hppa_can_use_hw_watchpoint, hppa_remove_hw_watchpoint): Declare. * hppah-nat.c: Include "gdb_string.h". (parent_attach_all): Delete extern declaration, moved to "infttrace.h". (hppa_can_use_hw_watchpoint): Change type of "type" parameter to int. (hppa_remove_hw_watchpoint, hppa_insert_hw_watchpoint): Ditto. * Makefile.in (infttrace_h): Define. (hpread.o): Update dependencies. (hppah-nat.o, hppa-hpux-tdep.o, hppa-tdep.o): Ditto. * hppa-hpux-tdep.c: Include "gdb_string.h". * hppa-tdep.c (hppa_frame_saved_pc): Initialize "old_pc". * infrun.c (handle_inferior_event): Always initialize stepped_after_stopped_by_watchpoint. Add default and remove fallthrough in switch statement. * infttrace.c (hppa_can_use_hw_watchpoint): Change type of "type" parameter to int. (hppa_remove_hw_watchpoint): Ditto.
Diffstat (limited to 'gdb/hpread.c')
-rw-r--r--gdb/hpread.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 6acf576..606ccfe 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -35,6 +35,8 @@
#include "gdb-stabs.h"
#include "gdbtypes.h"
#include "demangle.h"
+#include "somsolib.h"
+#include "gdb_assert.h"
/* Private information attached to an objfile which we use to find
and internalize the HP C debug symbols within that objfile. */
@@ -1024,7 +1026,7 @@ hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
while (VALID_CURR_FILE || VALID_CURR_MODULE)
{
- char *mod_name_string;
+ char *mod_name_string = NULL;
char *full_name_string;
/* First check for modules like "version.c", which have no code
@@ -2321,7 +2323,7 @@ static unsigned long
hpread_get_textlow (int global, int index, struct objfile *objfile,
int symcount)
{
- union dnttentry *dn_bufp;
+ union dnttentry *dn_bufp = NULL;
struct minimal_symbol *msymbol;
/* Look for a DNTT_TYPE_FUNCTION symbol. */
@@ -2340,6 +2342,11 @@ hpread_get_textlow (int global, int index, struct objfile *objfile,
&& index < symcount);
}
+ /* NOTE: cagney/2003-03-29: If !(index < symcount), dn_bufp is left
+ undefined and that means that the test below is using a garbage
+ pointer from the stack. */
+ gdb_assert (dn_bufp != NULL);
+
/* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This
might happen when a sourcefile has no functions. */
if (dn_bufp->dblock.kind == DNTT_TYPE_END)
@@ -3359,10 +3366,10 @@ static struct type *
hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
struct objfile *objfile, int newblock)
{
- struct type *type, *type1;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
+ struct type *type;
dnttpointer param;
union dnttentry *paramp;
char *name;
@@ -3378,11 +3385,17 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
}
else
{
+ struct type *type1 = NULL;
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
objfile));
+ /* NOTE: cagney/2003-03-29: Oh, no not again. TYPE1 is
+ potentially left undefined here. Assert it isn't and hope
+ the assert never fails ... */
+ gdb_assert (type1 != NULL);
+
replace_type (type, type1);
/* Mark it -- in the middle of processing */