This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: improve error reporting for `overlay auto' operations
- From: Michael Snyder <msnyder at cygnus dot com>
- To: Jim Blandy <jimb at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 14 Nov 2001 18:34:36 -0800
- Subject: Re: RFA: improve error reporting for `overlay auto' operations
- Organization: Red Hat
- References: <20011011222121.6EFED5E9D8@zwingli.cygnus.com>
Jim Blandy wrote:
>
> Michael, symfile.c is supposedly my area of maintainership, but this
> is overlay stuff; could you check it over for sanity?
Jim, sorry for leaving you hanging so long -- I think this change is fine.
Michael
> 2001-10-11 Jim Blandy <jimb@redhat.com>
>
> * symfile.c (simple_read_overlay_table): Make sure we can find
> both `_novlys' and `_ovly_table' before we try anything else;
> print a helpful error message.
> (simple_overlay_update): No need to print error message here.
>
> Index: gdb/symfile.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/symfile.c,v
> retrieving revision 1.239
> diff -c -r1.239 symfile.c
> *** gdb/symfile.c 2001/09/07 18:36:51 1.239
> --- gdb/symfile.c 2001/10/11 22:17:08
> ***************
> *** 3025,3054 ****
> static int
> simple_read_overlay_table (void)
> {
> ! struct minimal_symbol *msym;
>
> simple_free_overlay_table ();
> ! msym = lookup_minimal_symbol ("_novlys", 0, 0);
> ! if (msym != NULL)
> ! cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
> ! else
> ! return 0; /* failure */
> ! cache_ovly_table = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
> ! if (cache_ovly_table != NULL)
> {
> ! msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
> ! if (msym != NULL)
> ! {
> ! cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
> ! read_target_long_array (cache_ovly_table_base,
> ! (int *) cache_ovly_table,
> ! cache_novlys * 4);
> ! }
> ! else
> ! return 0; /* failure */
> }
> ! else
> ! return 0; /* failure */
> return 1; /* SUCCESS */
> }
>
> --- 3025,3059 ----
> static int
> simple_read_overlay_table (void)
> {
> ! struct minimal_symbol *novlys_msym, *ovly_table_msym;
>
> simple_free_overlay_table ();
> ! novlys_msym = lookup_minimal_symbol ("_novlys", 0, 0);
> ! if (! novlys_msym)
> {
> ! error ("Error reading inferior's overlay table: "
> ! "couldn't find `_novlys' variable\n"
> ! "in inferior. Use `overlay manual' mode.");
> ! return 0;
> }
> !
> ! ovly_table_msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
> ! if (! ovly_table_msym)
> ! {
> ! error ("Error reading inferior's overlay table: couldn't find "
> ! "`_ovly_table' array\n"
> ! "in inferior. Use `overlay manual' mode.");
> ! return 0;
> ! }
> !
> ! cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (novlys_msym), 4);
> ! cache_ovly_table
> ! = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
> ! cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (ovly_table_msym);
> ! read_target_long_array (cache_ovly_table_base,
> ! (int *) cache_ovly_table,
> ! cache_novlys * 4);
> !
> return 1; /* SUCCESS */
> }
>
> ***************
> *** 3149,3159 ****
> Or else we want all the sections, in which case it's actually
> more efficient to read the whole table in one block anyway. */
>
> ! if (simple_read_overlay_table () == 0) /* read failed? No table? */
> ! {
> ! warning ("Failed to read the target overlay mapping table.");
> ! return;
> ! }
> /* Now may as well update all sections, even if only one was requested. */
> ALL_OBJSECTIONS (objfile, osect)
> if (section_is_overlay (osect->the_bfd_section))
> --- 3154,3162 ----
> Or else we want all the sections, in which case it's actually
> more efficient to read the whole table in one block anyway. */
>
> ! if (! simple_read_overlay_table ())
> ! return;
> !
> /* Now may as well update all sections, even if only one was requested. */
> ALL_OBJSECTIONS (objfile, osect)
> if (section_is_overlay (osect->the_bfd_section))