* Re: GDB 5.0 won't build on GNU/Linux/sparc
[not found] <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br>
@ 2000-05-20 2:49 ` Alexandre Oliva
[not found] ` <392730E1.22BE968B@cygnus.com>
2000-05-20 10:08 ` Michael Snyder
2000-05-22 19:12 ` Kevin Buettner
2 siblings, 1 reply; 5+ messages in thread
From: Alexandre Oliva @ 2000-05-20 2:49 UTC (permalink / raw)
To: gdb-patches
On May 20, 2000, Alexandre Oliva <aoliva@cygnus.com> wrote:
> On GNU/Linux/sparc, it builds correctly, but it still doesn't work
> :-( child_resume is called with step==1, and aborts because
> SOFTWARE_SINGLE_STEP_P is also 1.
This patch fixes this problem, and now it appears to work (not that I
have tested it extensively!)
The problem was that, when resume issued the software single step
command, it cleared `step'. Later on, it would test whether step was
zero and think it had been asked to `continue'. Ok to install?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB 5.0 won't build on GNU/Linux/sparc
[not found] <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br>
2000-05-20 2:49 ` GDB 5.0 won't build on GNU/Linux/sparc Alexandre Oliva
@ 2000-05-20 10:08 ` Michael Snyder
2000-05-22 19:12 ` Kevin Buettner
2 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2000-05-20 10:08 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 8705 bytes --]
Alexandre Oliva wrote:
>
> gdb/sparc-tdep.c contains code in supply_gregset() and fill_gregset()
> that will only compile on Solaris/sparc. glibc doesn't define
> prgreg_t, R_I7, R_PS, R_PC, R_nPC nor R_Y. In fact, registers from i0
> to i7 aren't even available in glibc's gregset. The solution is to
> disable USE_PROC_FS, which can be accomplished by #including the
> generic config/nm-linux.h from config/sparc/nm-linux.h, as all other
> architecture-specific `nm-linux.h's do (actually, it's also missing
> from config/powerpc/nm-linux.h). Unfortunately, I don't have access to a
> GNU/Linux/powerpc platform to test the second change. On
> GNU/Linux/sparc, it builds correctly, but it still doesn't work :-(
> child_resume is called with step==1, and aborts because
> SOFTWARE_SINGLE_STEP_P is also 1. I'm investigating. Meanwhile, ok
> to install? Release branch?
I'm not the sparc maintainer, but I did commit the changes that
caused you problems. Sorry about that. Your solution seems
correct -- I'll also have a look at using a few more ifdefs
in my new code.
Michael Snyder
> ---------------------------------------------------------------
> Index: gdb/ChangeLog
> from Alexandre Oliva <aoliva@cygnus.com>
>
> * config/sparc/nm-linux.h: Include config/nm-linux.h.
> * config/powerpc/nm-linux.h: Likewise.
>
> Index: gdb/config/sparc/nm-linux.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/sparc/nm-linux.h,v
> retrieving revision 1.1.1.3
> diff -u -r1.1.1.3 nm-linux.h
> --- gdb/config/sparc/nm-linux.h 1999/12/07 03:56:12 1.1.1.3
> +++ gdb/config/sparc/nm-linux.h 2000/05/20 07:06:17
> @@ -1,5 +1,5 @@
> /* Macro definitions for running gdb on a Sparc running Linux.
> - Copyright (C) 1989, 1992, 1996, 1998 Free Software Foundation, Inc.
> + Copyright (C) 1989, 1992, 1996, 1998, 2000 Free Software Foundation, Inc.
>
> This file is part of GDB.
>
> @@ -19,6 +19,7 @@
> Boston, MA 02111-1307, USA. */
>
> #include <nm-sysv4.h>
> +#include "nm-linux.h"
> #include "solib.h"
>
> #define FETCH_INFERIOR_REGISTERS
> Index: gdb/config/powerpc/nm-linux.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/powerpc/nm-linux.h,v
> retrieving revision 1.1
> diff -u -r1.1 nm-linux.h
> --- gdb/config/powerpc/nm-linux.h 2000/02/22 01:19:11 1.1
> +++ gdb/config/powerpc/nm-linux.h 2000/05/20 07:06:17
> @@ -18,6 +18,9 @@
> Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
>
> #ifndef NM_LINUX_H
> +
> +#include "nm-linux.h"
> +
> #define NM_LINUX_H
>
> /* Return sizeof user struct to callers in less machine dependent routines */
>
> ---------------------------------------------------------------
>
> --
> Alexandre Oliva Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
> Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
> Free Software Developer and Evangelist CS PhD student at IC-Unicamp
> oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me
From ac131313@cygnus.com Sat May 20 17:30:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Alexandre Oliva <aoliva@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com, Kevin Buettner <kevinb@cygnus.com>
Subject: Re: GDB 5.0 won't build on GNU/Linux/sparc
Date: Sat, 20 May 2000 17:30:00 -0000
Message-id: <39272DDF.5E6FB83A@cygnus.com>
References: <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br>
X-SW-Source: 2000-05/msg00316.html
Content-length: 1046
Alexandre Oliva wrote:
>
> gdb/sparc-tdep.c contains code in supply_gregset() and fill_gregset()
> that will only compile on Solaris/sparc. glibc doesn't define
> prgreg_t, R_I7, R_PS, R_PC, R_nPC nor R_Y. In fact, registers from i0
> to i7 aren't even available in glibc's gregset. The solution is to
> disable USE_PROC_FS, which can be accomplished by #including the
> generic config/nm-linux.h from config/sparc/nm-linux.h, as all other
> architecture-specific `nm-linux.h's do (actually, it's also missing
> from config/powerpc/nm-linux.h). Unfortunately, I don't have access to a
> GNU/Linux/powerpc platform to test the second change. On
> GNU/Linux/sparc, it builds correctly, but it still doesn't work :-(
> child_resume is called with step==1, and aborts because
> SOFTWARE_SINGLE_STEP_P is also 1. I'm investigating. Meanwhile, ok
> to install? Release branch?
Just the Linux/SPARC part of this patch is approved for the 5.0 branch.
It's up to Kevin Buettner decide what to do with the ppc part (w.r.t
5.0).
Thanks!
Andrew
From ac131313@cygnus.com Sat May 20 17:43:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Alexandre Oliva <aoliva@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: GDB 5.0 won't build on GNU/Linux/sparc
Date: Sat, 20 May 2000 17:43:00 -0000
Message-id: <392730E1.22BE968B@cygnus.com>
References: <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br> <ork8gpd00h.fsf@tamanduatei.dcc.unicamp.br>
X-SW-Source: 2000-05/msg00317.html
Content-length: 1107
Alexandre Oliva wrote:
>
> On May 20, 2000, Alexandre Oliva <aoliva@cygnus.com> wrote:
>
> > On GNU/Linux/sparc, it builds correctly, but it still doesn't work
> > :-( child_resume is called with step==1, and aborts because
> > SOFTWARE_SINGLE_STEP_P is also 1.
>
> This patch fixes this problem, and now it appears to work (not that I
> have tested it extensively!)
>
> The problem was that, when resume issued the software single step
> command, it cleared `step'. Later on, it would test whether step was
> zero and think it had been asked to `continue'. Ok to install?
>
> ------------------------------------------------------------------------
> Index: gdb/ChangeLog
> from Alexandre Oliva <aoliva@cygnus.com>
>
> * infrun.c (resume): Do not change continue to step if we single
> step on software.
I think this one needs more testing (wfi is dangerous at the best of
times).
Does anyone with one of the other targets with SOFTWARE_SINGLE_STEP_P=1
see this problem (wince, rs6000?, sunos4?).
(Alexandre, can you provide a concrete example as a reference point).
Andrew
From kettenis@wins.uva.nl Sun May 21 05:38:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sourceware.cygnus.com
Cc: jimb@cygnus.com
Subject: [RFA] Fall back on dynamic symtab in solib.c:bdf_lookup_symbol
Date: Sun, 21 May 2000 05:38:00 -0000
Message-id: <200005211238.e4LCcd100663@delius.kettenis.local>
X-SW-Source: 2000-05/msg00318.html
Content-length: 2132
It turns out that the dynamic linker on FreeBSD is stripped by
default. Since bfd_lookup_symbol() only checks the normal symbol
table, which isn't present in a stripped shared object, this means
that on FreeBSD the initial solib_event breakpoint cannot be set.
This patch makes bfd_lookup_symbol() fall back on the dynamic symtab,
which works since r_debug_state() is exported on FreeBSD.
OK to check this in?
Mark
P.S. By the way, it somwhat surprised me to see that the sybol table in
the dynamic linker on Solaris isn't stripped. They probably need the
symbols for their librtld_db debugging interface.
P.P.S. It also surprises me that apparently, none of the Linux
distributions is stripping their dynamic linker.
2000-05-21 Mark Kettenis <kettenis@gnu.org>
* solib.c (bfd_lookup_symbol): Fall back on the dynamic symbol
table if the symbol couldn't be found in the normal symbol table
(i.e. if the shared object in question was stripped).
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.14
diff -u -p -r1.14 solib.c
--- solib.c 2000/05/16 04:07:39 1.14
+++ solib.c 2000/05/21 12:26:33
@@ -545,7 +545,35 @@ bfd_lookup_symbol (abfd, symname)
}
do_cleanups (back_to);
}
- return (symaddr);
+
+ if (symaddr)
+ return symaddr;
+
+ /* On FreeBSD, the dynamic linker is stripped by default. So we'll
+ have to check the dynamic string table too. */
+
+ storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
+
+ if (storage_needed > 0)
+ {
+ symbol_table = (asymbol **) xmalloc (storage_needed);
+ back_to = make_cleanup (free, (PTR) symbol_table);
+ number_of_symbols = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
+
+ for (i = 0; i < number_of_symbols; i++)
+ {
+ sym = *symbol_table++;
+ if (STREQ (sym->name, symname))
+ {
+ /* Bfd symbols are section relative. */
+ symaddr = sym->value + sym->section->vma;
+ break;
+ }
+ }
+ do_cleanups (back_to);
+ }
+
+ return symaddr;
}
#ifdef HANDLE_SVR4_EXEC_EMULATORS
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB 5.0 won't build on GNU/Linux/sparc
[not found] ` <392730E1.22BE968B@cygnus.com>
@ 2000-05-21 9:25 ` Michael Snyder
2000-05-22 13:36 ` Alexandre Oliva
1 sibling, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2000-05-21 9:25 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Alexandre Oliva, gdb-patches
Andrew Cagney wrote:
>
> Alexandre Oliva wrote:
> >
> > On May 20, 2000, Alexandre Oliva <aoliva@cygnus.com> wrote:
> >
> > > On GNU/Linux/sparc, it builds correctly, but it still doesn't work
> > > :-( child_resume is called with step==1, and aborts because
> > > SOFTWARE_SINGLE_STEP_P is also 1.
> >
> > This patch fixes this problem, and now it appears to work (not that I
> > have tested it extensively!)
> >
> > The problem was that, when resume issued the software single step
> > command, it cleared `step'. Later on, it would test whether step was
> > zero and think it had been asked to `continue'. Ok to install?
> >
> > ------------------------------------------------------------------------
> > Index: gdb/ChangeLog
> > from Alexandre Oliva <aoliva@cygnus.com>
> >
> > * infrun.c (resume): Do not change continue to step if we single
> > step on software.
>
> I think this one needs more testing (wfi is dangerous at the best of
> times).
> Does anyone with one of the other targets with SOFTWARE_SINGLE_STEP_P=1
> see this problem (wince, rs6000?, sunos4?).
It was only last year that I removed SOFTWARE_SINGLE_STEP_P
from Solaris. It should be easy to put it back temporarily
for testing.
> (Alexandre, can you provide a concrete example as a reference point).
Yes, please!
Michael
From kettenis@wins.uva.nl Sun May 21 14:34:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATH] Fix stupid bug in i387-tdep.c:print_i387_value()
Date: Sun, 21 May 2000 14:34:00 -0000
Message-id: <200005212134.e4LLY6M00401@delius.kettenis.local>
X-SW-Source: 2000-05/msg00320.html
Content-length: 1127
Argh, I made a stupid mistake in my last change to the logic behind
"info float". Using this command will set some bytes on the stack to
zero, which may crash GDB (or perhaps do some other bad things to
it). I checked it in on both branches, just in case Andrew will spin
another release from the 5.0 branch.
Mark
2000-05-21 Mark Kettenis <kettenis@gnu.org>
* i387-tdep.c (print_i387_value): Cast &value to (char *) in
pointer arithmetic. Fixes a bug which manifested itself on
FreeBSD.
Index: i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.3
diff -u -p -r1.3 i387-tdep.c
--- i387-tdep.c 2000/04/12 00:22:56 1.3
+++ i387-tdep.c 2000/05/21 21:15:14
@@ -176,7 +176,8 @@ print_i387_value (char *raw)
{
/* Copy straight over, but take care of the padding. */
memcpy (&value, raw, FPU_REG_RAW_SIZE);
- memset (&value + FPU_REG_RAW_SIZE, 0, sizeof (value) - FPU_REG_RAW_SIZE);
+ memset ((char *) &value + FPU_REG_RAW_SIZE, 0,
+ sizeof (value) - FPU_REG_RAW_SIZE);
}
else
#endif
From ac131313@cygnus.com Sun May 21 20:37:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Mark Kettenis <kettenis@wins.uva.nl>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATH] Fix stupid bug in i387-tdep.c:print_i387_value()
Date: Sun, 21 May 2000 20:37:00 -0000
Message-id: <3928AB4B.A4CADAD5@cygnus.com>
References: <200005212134.e4LLY6M00401@delius.kettenis.local>
X-SW-Source: 2000-05/msg00321.html
Content-length: 487
Mark Kettenis wrote:
>
> Argh, I made a stupid mistake in my last change to the logic behind
> "info float". Using this command will set some bytes on the stack to
> zero, which may crash GDB (or perhaps do some other bad things to
> it). I checked it in on both branches, just in case Andrew will spin
> another release from the 5.0 branch.
Even if there is never a re-spin (we can play that one by ear), I'll
occasionally push out gdb 5.0.0.0.0.2000mmdd.tar.bz snapshots.
Andrew
From ac131313@cygnus.com Sun May 21 22:12:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [event-loop] Can command_loop_marker() be replaced by null_cleanup()?
Date: Sun, 21 May 2000 22:12:00 -0000
Message-id: <3928C1A3.DFECB9E0@cygnus.com>
X-SW-Source: 2000-05/msg00322.html
Content-length: 152
Hello,
Looking at it, the two look very similar. Perhaphs,
command_loop_marker() is used so that the specific cleanup is easier to
identify?
Andrew
From ac131313@cygnus.com Sun May 21 22:42:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [patch] remove make_cleanup_func from top.c.
Date: Sun, 21 May 2000 22:42:00 -0000
Message-id: <3928C891.84475516@cygnus.com>
X-SW-Source: 2000-05/msg00323.html
Content-length: 11369
Just FYI,
Andrew
Mon May 22 15:21:38 2000 Andrew Cagney <cagney@b1.cygnus.com>
* top.h (command_loop_marker): Change signature to match
make_cleanup_ftype.
* top.c (command_loop_marker): Update.
(command_loop, simplified_command_loop), event-top.c
(command_handler): Remove cast using make_cleanup_func.
* event-top.c (command_handler): Ditto.
* top.c (do_chdir_cleanup): New function.
(gdb_init): Use. Use xstrdup instead of strsave.
* top.c (do_fclose_cleanup): New function.
(source_command): Use.
* top.c (do_restore_instream_cleanup): Rename
source_cleanup. Change signature to match make_cleanup.
(read_command_filem execute_user_command): Update. Remove cast
using make_cleanup_func.
* top.c (do_free_command_lines_cleanup,
make_cleanup_free_command_lines): New funtions.
(get_command_line, read_command_lines): Use.
* top.c (arg_cleanup): Change signature to match make_cleanup.
(setup_user_args): Remove cast using make_cleanup_func.
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.5
diff -p -r1.5 event-top.c
*** event-top.c 2000/03/30 18:54:28 1.5
--- event-top.c 2000/05/22 05:38:52
*************** command_handler (char *command)
*** 487,493 ****
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
#if defined(TUI)
insert_mode = 0;
--- 487,493 ----
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup (command_loop_marker, 0);
#if defined(TUI)
insert_mode = 0;
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.11
diff -p -r1.11 top.c
*** top.c 2000/04/26 12:41:48 1.11
--- top.c 2000/05/22 05:39:04
*************** static char *readline_line_completion_fu
*** 76,82 ****
/* NOTE 1999-04-29: this function will be static again, after we make the
event loop be the default command loop for gdb, and we merge
event-top.c into this file, top.c */
! /* static */ void command_loop_marker PARAMS ((int));
static void while_command PARAMS ((char *, int));
--- 76,82 ----
/* NOTE 1999-04-29: this function will be static again, after we make the
event loop be the default command loop for gdb, and we merge
event-top.c into this file, top.c */
! /* static */ void command_loop_marker (void *);
static void while_command PARAMS ((char *, int));
*************** static char *locate_arg PARAMS ((char *)
*** 101,107 ****
static char *insert_args PARAMS ((char *));
! static void arg_cleanup PARAMS ((void));
static void init_main PARAMS ((void));
--- 101,107 ----
static char *insert_args PARAMS ((char *));
! static void arg_cleanup (void *);
static void init_main PARAMS ((void));
*************** static void set_debug PARAMS ((char *, i
*** 157,164 ****
static void disconnect PARAMS ((int));
#endif
! static void source_cleanup PARAMS ((FILE *));
/* Default command line prompt. This is overriden in some configs. */
#ifndef DEFAULT_PROMPT
--- 157,166 ----
static void disconnect PARAMS ((int));
#endif
! static void do_restore_instream_cleanup (void *stream);
+ static struct cleanup *make_cleanup_free_command_lines (struct command_line **);
+
/* Default command line prompt. This is overriden in some configs. */
#ifndef DEFAULT_PROMPT
*************** static int source_error_allocated;
*** 760,767 ****
user-defined command). */
static void
! source_cleanup (stream)
! FILE *stream;
{
/* Restore the previous input stream. */
instream = stream;
--- 762,768 ----
user-defined command). */
static void
! do_restore_instream_cleanup (void *stream)
{
/* Restore the previous input stream. */
instream = stream;
*************** read_command_file (stream)
*** 774,780 ****
{
struct cleanup *cleanups;
! cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream);
instream = stream;
command_loop ();
do_cleanups (cleanups);
--- 775,781 ----
{
struct cleanup *cleanups;
! cleanups = make_cleanup (do_restore_instream_cleanup, instream);
instream = stream;
command_loop ();
do_cleanups (cleanups);
*************** extern void init_proc PARAMS ((void));
*** 784,789 ****
--- 785,799 ----
void (*pre_init_ui_hook) PARAMS ((void));
+ #ifdef __MSDOS__
+ void
+ do_chdir_cleanup (void *old_dir)
+ {
+ chdir (old_dir);
+ free (old_dir);
+ }
+ #endif
+
void
gdb_init (argv0)
char *argv0;
*************** gdb_init (argv0)
*** 799,805 ****
#ifdef __MSDOS__
/* Make sure we return to the original directory upon exit, come
what may, since the OS doesn't do that for us. */
! make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory));
#endif
init_cmd_lists (); /* This needs to be done first */
--- 809,815 ----
#ifdef __MSDOS__
/* Make sure we return to the original directory upon exit, come
what may, since the OS doesn't do that for us. */
! make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
#endif
init_cmd_lists (); /* This needs to be done first */
*************** get_command_line (type, arg)
*** 884,890 ****
/* Allocate and build a new command line structure. */
cmd = build_command_line (type, arg);
! old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd);
/* Read in the body of this command. */
if (recurse_read_control_structure (cmd) == invalid_control)
--- 894,900 ----
/* Allocate and build a new command line structure. */
cmd = build_command_line (type, arg);
! old_chain = make_cleanup_free_command_lines (&cmd);
/* Read in the body of this command. */
if (recurse_read_control_structure (cmd) == invalid_control)
*************** if_command (arg, from_tty)
*** 1261,1267 ****
/* Cleanup */
static void
! arg_cleanup ()
{
struct user_args *oargs = user_args;
if (!user_args)
--- 1271,1277 ----
/* Cleanup */
static void
! arg_cleanup (void *ignore)
{
struct user_args *oargs = user_args;
if (!user_args)
*************** setup_user_args (p)
*** 1288,1294 ****
args->next = user_args;
user_args = args;
! old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0);
if (p == NULL)
return old_chain;
--- 1298,1304 ----
args->next = user_args;
user_args = args;
! old_chain = make_cleanup (arg_cleanup, 0/*ignored*/);
if (p == NULL)
return old_chain;
*************** execute_user_command (c, args)
*** 1452,1458 ****
/* Set the instream to 0, indicating execution of a
user-defined function. */
! old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream);
instream = (FILE *) 0;
while (cmdlines)
{
--- 1462,1468 ----
/* Set the instream to 0, indicating execution of a
user-defined function. */
! old_chain = make_cleanup (do_restore_instream_cleanup, instream);
instream = (FILE *) 0;
while (cmdlines)
{
*************** execute_command (p, from_tty)
*** 1577,1584 ****
gdb to use the event loop as the default command loop and we merge
event-top.c into this file, top.c */
/* static */ void
! command_loop_marker (foo)
! int foo;
{
}
--- 1587,1593 ----
gdb to use the event loop as the default command loop and we merge
event-top.c into this file, top.c */
/* static */ void
! command_loop_marker (void *foo)
{
}
*************** command_loop ()
*** 1609,1615 ****
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
#if defined(TUI)
/* A bit of paranoia: I want to make sure the "insert_mode" global
--- 1618,1624 ----
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup (command_loop_marker, 0);
#if defined(TUI)
/* A bit of paranoia: I want to make sure the "insert_mode" global
*************** simplified_command_loop (read_input_func
*** 1690,1696 ****
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
/* Get a command-line. */
command = (*read_input_func) (instream == stdin ?
--- 1699,1705 ----
quit_flag = 0;
if (instream == stdin && stdin_is_tty)
reinitialize_more_filter ();
! old_chain = make_cleanup (command_loop_marker, 0);
/* Get a command-line. */
command = (*read_input_func) (instream == stdin ?
*************** read_command_lines (prompt_arg, from_tty
*** 2864,2871 ****
else
{
head = next;
! old_chain = make_cleanup ((make_cleanup_func) free_command_lines,
! &head);
}
tail = next;
}
--- 2873,2879 ----
else
{
head = next;
! old_chain = make_cleanup_free_command_lines (&head);
}
tail = next;
}
*************** free_command_lines (lptr)
*** 2914,2919 ****
--- 2922,2939 ----
l = next;
}
}
+
+ static void
+ do_free_command_lines_cleanup (void *arg)
+ {
+ free_command_lines (arg);
+ }
+
+ static struct cleanup *
+ make_cleanup_free_command_lines (struct command_line **arg)
+ {
+ return make_cleanup (do_free_command_lines_cleanup, arg);
+ }
\f
/* Add an element to the list of info subcommands. */
*************** source_cleanup_lines (args)
*** 3748,3753 ****
--- 3768,3779 ----
}
/* ARGSUSED */
+ static void
+ do_fclose_cleanup (void *stream)
+ {
+ fclose (stream);
+ }
+
void
source_command (args, from_tty)
char *args;
*************** source_command (args, from_tty)
*** 3776,3782 ****
return;
}
! make_cleanup ((make_cleanup_func) fclose, stream);
old_lines.old_line = source_line_number;
old_lines.old_file = source_file_name;
--- 3802,3808 ----
return;
}
! make_cleanup (do_fclose_cleanup, stream);
old_lines.old_line = source_line_number;
old_lines.old_file = source_file_name;
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.1.1.11
diff -p -r1.1.1.11 top.h
*** top.h 2000/02/03 04:14:30 1.1.1.11
--- top.h 2000/05/22 05:39:04
*************** extern void simplified_command_loop PARA
*** 39,45 ****
extern int quit_confirm PARAMS ((void));
extern void quit_force PARAMS ((char *, int));
extern void quit_command PARAMS ((char *, int));
! extern void command_loop_marker PARAMS ((int));
extern int quit_cover PARAMS ((PTR));
extern void execute_command PARAMS ((char *, int));
--- 39,45 ----
extern int quit_confirm PARAMS ((void));
extern void quit_force PARAMS ((char *, int));
extern void quit_command PARAMS ((char *, int));
! extern void command_loop_marker (void *);
extern int quit_cover PARAMS ((PTR));
extern void execute_command PARAMS ((char *, int));
From ac131313@cygnus.com Sun May 21 23:19:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [patch] procfs.c and make_cleanup_func
Date: Sun, 21 May 2000 23:19:00 -0000
Message-id: <3928D157.9EB3E84E@cygnus.com>
X-SW-Source: 2000-05/msg00324.html
Content-length: 4743
Yawn :-)
Andrew
Mon May 22 15:49:13 2000 Andrew Cagney <cagney@b1.cygnus.com>
* procfs.c (info_proc_cmd): Use make_cleanup_freeargv.
(proc_iterate_over_mappings): Use make_cleanup_close.
(proc_get_LDT_entry): Ditto.
(do_closedir_cleanup): New function.
(proc_update_threads): Use.
(do_destroy_procinfo_cleanup): New function.
(info_proc_cmd): Use.
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.11
diff -p -r1.11 procfs.c
*** procfs.c 2000/05/10 17:38:16 1.11
--- procfs.c 2000/05/22 06:16:13
*************** static procinfo *find_procinfo_or_die PA
*** 328,333 ****
--- 328,334 ----
static procinfo *find_procinfo PARAMS ((int pid, int tid));
static procinfo *create_procinfo PARAMS ((int pid, int tid));
static void destroy_procinfo PARAMS ((procinfo *p));
+ static void do_destroy_procinfo_cleanup (void *);
static void dead_procinfo PARAMS ((procinfo *p,
char *msg, int killp));
static int open_procinfo_files PARAMS ((procinfo *p, int which));
*************** destroy_procinfo (pi)
*** 683,688 ****
--- 684,695 ----
}
}
+ static void
+ do_destroy_procinfo_cleanup (void *pi)
+ {
+ destroy_procinfo (pi);
+ }
+
enum { NOKILL, KILL };
/*
*************** proc_iterate_over_mappings (func)
*** 2633,2639 ****
proc_error (pi, "proc_iterate_over_mappings (open)", __LINE__);
/* Make sure it gets closed again. */
! make_cleanup ((make_cleanup_func) close, (void *) map_fd);
/* Allocate space for mapping (lifetime only for this function). */
map = alloca (sizeof (struct prmap));
--- 2640,2646 ----
proc_error (pi, "proc_iterate_over_mappings (open)", __LINE__);
/* Make sure it gets closed again. */
! make_cleanup_close (map_fd);
/* Allocate space for mapping (lifetime only for this function). */
map = alloca (sizeof (struct prmap));
*************** proc_get_LDT_entry (pi, key)
*** 2744,2750 ****
return NULL;
}
/* Make sure it gets closed again! */
! old_chain = make_cleanup ((make_cleanup_func) close, (void *) fd);
/* Now 'read' thru the table, find a match and return it. */
while (read (fd, ldt_entry, sizeof (struct ssd)) == sizeof (struct ssd))
--- 2751,2757 ----
return NULL;
}
/* Make sure it gets closed again! */
! old_chain = make_cleanup_close (fd);
/* Now 'read' thru the table, find a match and return it. */
while (read (fd, ldt_entry, sizeof (struct ssd)) == sizeof (struct ssd))
*************** proc_update_threads (pi)
*** 3013,3018 ****
--- 3020,3031 ----
/*
* Unixware and Solaris 6 (and later) version
*/
+ static void
+ do_closedir_cleanup (void *dir)
+ {
+ closedir (dir);
+ }
+
int
proc_update_threads (pi)
procinfo *pi;
*************** proc_update_threads (pi)
*** 3051,3057 ****
if ((dirp = opendir (pathname)) == NULL)
proc_error (pi, "update_threads, opendir", __LINE__);
! old_chain = make_cleanup ((make_cleanup_func) closedir, dirp);
while ((direntry = readdir (dirp)) != NULL)
if (direntry->d_name[0] != '.') /* skip '.' and '..' */
{
--- 3064,3070 ----
if ((dirp = opendir (pathname)) == NULL)
proc_error (pi, "update_threads, opendir", __LINE__);
! old_chain = make_cleanup (do_closedir_cleanup, dirp);
while ((direntry = readdir (dirp)) != NULL)
if (direntry->d_name[0] != '.') /* skip '.' and '..' */
{
*************** info_proc_cmd (args, from_tty)
*** 5033,5039 ****
if ((argv = buildargv (args)) == NULL)
nomem (0);
else
! make_cleanup ((make_cleanup_func) freeargv, argv);
}
while (argv != NULL && *argv != NULL)
{
--- 5046,5052 ----
if ((argv = buildargv (args)) == NULL)
nomem (0);
else
! make_cleanup_freeargv (argv);
}
while (argv != NULL && *argv != NULL)
{
*************** info_proc_cmd (args, from_tty)
*** 5067,5073 ****
/* No. So open a procinfo for it, but
remember to close it again when finished. */
process = create_procinfo (pid, 0);
! make_cleanup ((make_cleanup_func) destroy_procinfo, process);
if (!open_procinfo_files (process, FD_CTL))
proc_error (process, "info proc, open_procinfo_files", __LINE__);
}
--- 5080,5086 ----
/* No. So open a procinfo for it, but
remember to close it again when finished. */
process = create_procinfo (pid, 0);
! make_cleanup (do_destroy_procinfo_cleanup, process);
if (!open_procinfo_files (process, FD_CTL))
proc_error (process, "info proc, open_procinfo_files", __LINE__);
}
From aoliva@cygnus.com Mon May 22 00:26:00 2000
From: Alexandre Oliva <aoliva@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: A few more am33 unsigned SP-offset fixes.
Date: Mon, 22 May 2000 00:26:00 -0000
Message-id: <orsnvbxcyx.fsf@tamanduatei.dcc.unicamp.br>
X-SW-Source: 2000-05/msg00325.html
Content-length: 335
On Apr 9th, I had posted a patch for the mn10300 sim that fixed insns
involving SP offsets so that they'd zero-extend the offsets, as
specified in the AM33 Instruction Manual. Unfortunately, I had missed
some insns, because their leading comments were wrong :-(
Here's a patch that fixes the comments and the insns. Ok to install?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB 5.0 won't build on GNU/Linux/sparc
[not found] ` <392730E1.22BE968B@cygnus.com>
2000-05-21 9:25 ` Michael Snyder
@ 2000-05-22 13:36 ` Alexandre Oliva
1 sibling, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2000-05-22 13:36 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
On May 20, 2000, Andrew Cagney <ac131313@cygnus.com> wrote:
> (Alexandre, can you provide a concrete example as a reference point).
Without this patch, running:
GNU/Linux/sparc% ./gdb ./gdb
[snip]
(gdb) run
just abort()s as described.
--
Alexandre Oliva Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GDB 5.0 won't build on GNU/Linux/sparc
[not found] <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br>
2000-05-20 2:49 ` GDB 5.0 won't build on GNU/Linux/sparc Alexandre Oliva
2000-05-20 10:08 ` Michael Snyder
@ 2000-05-22 19:12 ` Kevin Buettner
2 siblings, 0 replies; 5+ messages in thread
From: Kevin Buettner @ 2000-05-22 19:12 UTC (permalink / raw)
To: Alexandre Oliva, gdb-patches; +Cc: David Taylor
On May 20, 4:21am, Alexandre Oliva wrote:
> gdb/sparc-tdep.c contains code in supply_gregset() and fill_gregset()
> that will only compile on Solaris/sparc. glibc doesn't define
> prgreg_t, R_I7, R_PS, R_PC, R_nPC nor R_Y. In fact, registers from i0
> to i7 aren't even available in glibc's gregset. The solution is to
> disable USE_PROC_FS, which can be accomplished by #including the
> generic config/nm-linux.h from config/sparc/nm-linux.h, as all other
> architecture-specific `nm-linux.h's do
I'm more than a little surprised that supply_gregset() and fill_gregset()
appear in sparc-tdep.c! In my opinion, they belong in sparc-nat.c.
The reason is that, some day, we'll get gdb fully multiarched. When
this happens, you may wish to build an i386-*-linux* hosted gdb which
is capable of debugging natively as well as remote sparc targets. To
do so will require that both i386-linux-nat.c AND sparc-tdep.c be linked
into the same executable. Both of these files define supply_gregset().
This is clearly wrong; supply_gregset() needs to be defined only once
and (IMO) it should only be defined in the *-nat.c files.
> (actually, it's also missing
> from config/powerpc/nm-linux.h). Unfortunately, I don't have access to a
> GNU/Linux/powerpc platform to test the second change. On
> GNU/Linux/sparc, it builds correctly, but it still doesn't work :-(
> child_resume is called with step==1, and aborts because
> SOFTWARE_SINGLE_STEP_P is also 1. I'm investigating. Meanwhile, ok
> to install? Release branch?
I've tested your change to config/powerpc/nm-linux.h; everything builds
okay and I see no regressions. Therefore this change is approved for
the trunk.
It could probably go on the release branch as well, but I haven't
tested it there and would rather not have it go on the release branch
unless it's tested. Also, I see no compelling reason for it to go in
the release branch. To the best of my knowledge, the spurious
definition of USE_PROC_FS does not cause problems for the PowerPC
GNU/Linux port. (However I do agree that it would be better if it
were undefined.)
After the generic nm-linux.h file is included in the powerpc specific
nm-linux.h file, this latter file needs to be cleaned up somewhat as
it contains some defines which are duplicates of those contained in
the generic version. But I will do this after you commit your change
for config/powerpc/nm-linux.h.
Kevin
From msnyder@cygnus.com Mon May 22 19:24:00 2000
From: Michael Snyder <msnyder@cygnus.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: Alexandre Oliva <aoliva@cygnus.com>, gdb-patches@sourceware.cygnus.com, David Taylor <taylor@cygnus.com>
Subject: Re: GDB 5.0 won't build on GNU/Linux/sparc
Date: Mon, 22 May 2000 19:24:00 -0000
Message-id: <3929EBCF.2178@cygnus.com>
References: <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br> <1000523021152.ZM4540@ocotillo.lan>
X-SW-Source: 2000-05/msg00336.html
Content-length: 1112
Kevin Buettner wrote:
>
> On May 20, 4:21am, Alexandre Oliva wrote:
>
> > gdb/sparc-tdep.c contains code in supply_gregset() and fill_gregset()
> > that will only compile on Solaris/sparc. glibc doesn't define
> > prgreg_t, R_I7, R_PS, R_PC, R_nPC nor R_Y. In fact, registers from i0
> > to i7 aren't even available in glibc's gregset. The solution is to
> > disable USE_PROC_FS, which can be accomplished by #including the
> > generic config/nm-linux.h from config/sparc/nm-linux.h, as all other
> > architecture-specific `nm-linux.h's do
>
> I'm more than a little surprised that supply_gregset() and fill_gregset()
> appear in sparc-tdep.c! In my opinion, they belong in sparc-nat.c.
Well... you're right that their being in sparc-tdep.c is questionable,
but I'm not sure they fit any better in sparc-nat.c, unles that file
is renamed to sparc-solaris-nat.c. These functions are specific to
/proc, which is (one reason) why they would not build on Linux.
If (indeed) sparc-nat.c is peculiar to Solaris, then we could move
all of the #if (USE_PROC_FS) code from sparc-tdep.c to there.
Michael
From ac131313@cygnus.com Mon May 22 20:33:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH RFA] Remove PARAMS from gdb source files
Date: Mon, 22 May 2000 20:33:00 -0000
Message-id: <3929FBB8.D4E7673B@cygnus.com>
References: <1000522175421.ZM9859@ocotillo.lan>
X-SW-Source: 2000-05/msg00337.html
Content-length: 1256
Kevin Buettner wrote:
> After this patch is applied, there are still around 260 occurrences
> of PARAMS in the gdb source files. This is a reasonable number to
> do by hand, possibly with the assistance of a script similar to the
> one I used for generating the patch below. I propose that we first
> make the changes contained in the patch below and then clean the rest
> up in later passes.
>
> I'm not sure how to go about getting approval for a change this
> massive. I guess I'll wait about a week for objections, complaints,
> etc. and then leave it up to Andrew for a final thumbs up or thumbs
> down.
I'd just set a firm date/time-range and then, in it goes. Provided
everyone has a few days warning and knows where the cut over date is
there shouldn't be problems.
What time? Well the best is likely to be around midnight Sunday GMT
(that happens to be a normal Monday morning work day for me :-) I'm
willing to run the script for you or you can set a time more convenient
for your self and run it then (in truth there is never a good time :-).
Having indent (no matter how bad its output :-) is also important. If
someone gets stuck with a header file that got ripped apart they can
re-sync it using indent.
Thanks for this!
Andrew
From jakub@redhat.com Tue May 23 00:06:00 2000
From: Jakub Jelinek <jakub@redhat.com>
To: msnyder@cygnus.com, jimb@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] Sparc Linux stuff
Date: Tue, 23 May 2000 00:06:00 -0000
Message-id: <20000523091140.C474@sunsite.ms.mff.cuni.cz>
X-SW-Source: 2000-05/msg00338.html
Content-length: 57511
Hi!
Following patch makes gdb 5.0 compile on sparc-*-linux and adds a
semi-usable support for sparc64-*-linux.
This patch works just fine against gdb from say November, but after somewhen
in December things broke - that's why I haven't submitted the patch yet
(no matter whether this patch is in or not (in the latter case one has to tweak a
few things to make things compile), e.g. next command does not work.
Say
#include <stdio.h>
void foo(void)
{
printf("a\n");
}
void bar(void)
{
printf("b\n");
}
void main(void)
{
foo();
bar();
foo();
}
compiled with -g -O0, putting breakpoint on main works just fine but then if
I enter next, it goes on until program exit (ie. does not stop where it
should).
Can somebody please look at this? I'm not familiar enough with the infptrace
and related code, so it would take me a lot of time to find out what's going
on and I have a bunch of gcc issues I have to go after.
If it works, I can try to finish the sparc64 debugging.
).
2000-03-17 Jakub Jelinek <jakub@redhat.com>
* config/sparc/tm-linux.h: Work around asm/ptrace.h and sys/ptrace.h
header clash.
* config/sparc/nm-linux.h (CHILD_XFER_MEMORY): Define - Linux/SPARC
does not support PT_READ_U/PT_WRITE_U, on the other side
PTHREAD_READTEXT/WRITETEXT is much more efficient.
(USE_PROC_FS): Undefine.
* config/sparc/linux.mh (NATDEPFILES): Use sparc-linux-nat instead
of sparc-nat.
* sparc-nat.c: Delete linux asm/reg.h include.
* sparc-linux-nat.c: New file.
* defs.h (TARGET_MAX_PTR_BIT): Define, if not yet defined.
* blockframe.c (sigtramp_saved_pc): Use TARGET_MAX_PTR_BIT instead
of TARGET_PTR_BIT since it must be a constant.
* solib.c (elf_locate_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* lin-thread.c (save_inferior_pid, restore_inferior_pid): Likewise.
* linux-thread.c (save_inferior_pid, restore_inferior_pid): Likewise.
* configure.tgt: Support sparc64-*-linux*.
* configure.host: Likewise.
* config/sparc/linux64.mh: New file.
* config/sparc/linux64.mt: New file.
* config/sparc/xm-linux64.h: New file.
* config/sparc/nm-linux64.h: New file.
* config/sparc/tm-linux64.h: New file.
* config/sparc/tm-sp64.h (everywhere): Use is_sparc64 expression
(which can be constant for gdb supporting only one architecture size)
instead of GDB_TARGET_IS_SPARC64 define. Add GSR register.
(REGISTER_BYTE64, REGISTER_RAW_SIZE64): Define like REGISTER_BYTE
or REGISTER_RAW_SIZE, only for gdb supporting both architectures
point at full 64bit register for general and special registers.
* config/sparc/tm-sparc.h (is_sparc64): Define to constant 0.
(REGISTER_BYTE64, REGISTER_RAW_SIZE64): Define to REGISTER_BYTE
resp. REGISTER_RAW_SIZE as it is the same for 32bit only debugging.
* sparc-tdep.c (everywhere): Use is_sparc64 expression instead of
GDB_TARGET_IS_SPARC64 define where needed.
(sparc_target_architecture_hook): Set gdb_is_sparc64 variable
for GDB_TARGET_IS_SPARC_BI_ARCH from bfd information.
--- gdb/config/sparc/tm-linux.h.jj Tue Dec 7 04:56:12 1999
+++ gdb/config/sparc/tm-linux.h Fri Mar 17 16:09:14 2000
@@ -1,5 +1,5 @@
/* Macro definitions for GDB for a Sparc running Linux.
- Copyright 1989, 1992, 1994, 1995, 1998 Free Software Foundation, Inc.
+ Copyright 1989, 1992, 1994, 1995, 1998, 2000 Free Software Foundation, Inc.
This file is part of GDB.
@@ -26,5 +26,32 @@
#define SIGCONTEXT_PC_OFFSET 12
#include "tm-linux.h"
+
+/* Work-around for asm/sigcontext.h and asm/elf.h < 2.4 deficiencies */
+#include <features.h>
+
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 2
+
+#include <signal.h>
+#include <sys/procfs.h>
+
+#undef PTRACE_GETREGS /* possible noise from <asm/ptrace.h> */
+#undef PTRACE_SETREGS
+#undef PTRACE_GETFPREGS
+#undef PTRACE_SETFPREGS
+#undef PT_DETACH
+
+#include <sys/ptrace.h>
+
+#undef PT_DETACH
+#define PT_DETACH PTRACE_SUNDETACH
+#ifndef PTRACE_READTEXT
+#define PTRACE_READTEXT 18
+#define PTRACE_WRITETEXT 19
+#define PTRACE_READDATA 18
+#define PTRACE_WRITEDATA 17
+#endif
+
+#endif /* glibc 2.0, 2.1 */
#endif /* TM_SPARCLINUX_H */
--- gdb/config/sparc/nm-linux.h.jj Tue Dec 7 04:56:12 1999
+++ gdb/config/sparc/nm-linux.h Fri Mar 17 16:09:14 2000
@@ -1,5 +1,5 @@
/* Macro definitions for running gdb on a Sparc running Linux.
- Copyright (C) 1989, 1992, 1996, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1992, 1996, 1998, 2000 Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,8 +22,5 @@
#include "solib.h"
#define FETCH_INFERIOR_REGISTERS
-
-/* Return sizeof user struct to callers in less machine dependent routines */
-
-#define KERNEL_U_SIZE kernel_u_size()
-extern int kernel_u_size PARAMS ((void));
+#define CHILD_XFER_MEMORY
+#undef USE_PROC_FS
--- gdb/config/sparc/linux.mh.jj Tue Dec 7 04:56:12 1999
+++ gdb/config/sparc/linux.mh Fri Mar 17 16:09:14 2000
@@ -2,7 +2,7 @@
XDEPFILES= ser-tcp.o
XM_FILE= xm-linux.h
NAT_FILE= nm-linux.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-linux-nat.o \
linux-thread.o
HOST_IPC=-DBSD_IPC
GDBSERVER_DEPFILES= low-sparc.o
--- gdb/config/sparc/linux64.mh.jj Fri Mar 17 09:47:38 2000
+++ gdb/config/sparc/linux64.mh Fri Mar 17 16:09:14 2000
@@ -0,0 +1,8 @@
+# Host: UltraSPARC, running Linux 64bit programs
+XDEPFILES= ser-tcp.o
+XM_FILE= xm-linux64.h
+NAT_FILE= nm-linux64.h
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-linux-nat.o \
+ linux-thread.o
+HOST_IPC=-DBSD_IPC
+GDBSERVER_DEPFILES= low-sparc.o
--- gdb/config/sparc/linux64.mt.jj Fri Mar 17 09:49:23 2000
+++ gdb/config/sparc/linux64.mt Fri Mar 17 16:09:14 2000
@@ -0,0 +1,3 @@
+# Target: UltraSPARC, running Linux 64bit programs
+TDEPFILES= sparc-tdep.o solib.o
+TM_FILE= tm-linux64.h
--- gdb/config/sparc/nm-linux64.h.jj Fri Mar 17 09:51:15 2000
+++ gdb/config/sparc/nm-linux64.h Fri Mar 17 16:09:14 2000
@@ -0,0 +1,28 @@
+/* Macro definitions for running gdb on a UltraSPARC running Linux.
+ Copyright (C) 1989, 1992, 1996, 1998, 2000 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <nm-sysv4.h>
+#include "solib.h"
+
+#define FETCH_INFERIOR_REGISTERS
+#define CHILD_XFER_MEMORY
+#undef USE_PROC_FS
+#define PTRACE_ARG3_TYPE long
+#define PTRACE_XFER_TYPE long
--- gdb/config/sparc/tm-linux64.h.jj Fri Oct 29 12:23:12 1999
+++ gdb/config/sparc/tm-linux64.h Fri Mar 17 16:09:14 2000
@@ -0,0 +1,37 @@
+/* Macro definitions for GDB for a UltraSparc running Linux.
+ Copyright 1989, 1992, 1994, 1995, 1998, 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef TM_SPARCLINUX64_H
+#define TM_SPARCLINUX64_H
+
+#define GDB_TARGET_IS_SPARC_BI_ARCH
+
+#include "sparc/tm-sp64.h"
+
+#define SIGCONTEXT_PC_OFFSET 16 /* See asm-sparc64/sigcontext.h */
+
+/* We always want full V9 + Ultra VIS stuff... */
+#undef TM_PRINT_INSN_MACH
+#define TM_PRINT_INSN_MACH bfd_mach_sparc_v9a
+
+#define GDB_PTRACE_REGS64
+
+#include "tm-sysv4.h"
+
+#endif /* TM_SPARCLINUX64_H */
--- gdb/config/sparc/tm-sp64.h.jj Tue Aug 31 03:08:02 1999
+++ gdb/config/sparc/tm-sp64.h Fri Mar 17 16:09:14 2000
@@ -1,6 +1,6 @@
/* Target machine sub-parameters for SPARC64, for GDB, the GNU debugger.
This is included by other tm-*.h files to define SPARC64 cpu-related info.
- Copyright 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
This is (obviously) based on the SPARC Vn (n<9) port.
Contributed by Doug Evans (dje@cygnus.com).
Further modified by Bob Manson (manson@cygnus.com).
@@ -22,6 +22,12 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+#define is_sparc64 gdb_is_sparc64
+#else
+#define is_sparc64 1
+#endif
+
#define GDB_TARGET_IS_SPARC64
struct value;
@@ -102,12 +108,12 @@ struct value;
function calls. */
#undef STACK_ALIGN
-#define STACK_ALIGN(ADDR) (((ADDR) + 15 ) & -16)
+#define STACK_ALIGN(ADDR) (is_sparc64 ? (((ADDR) + 15) & -16L) : (((ADDR) + 7) & 0xfffffff8))
/* Number of machine registers. */
#undef NUM_REGS
-#define NUM_REGS 125
+#define NUM_REGS 126
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
@@ -141,6 +147,7 @@ struct value;
"ver", "tick", "pil", "pstate", \
"tstate", "tba", "tl", "tt", "tpc", "tnpc", "wstate", \
"cwp", "cansave", "canrestore", "cleanwin", "otherwin", \
+ "gsr", \
"asr16", "asr17", "asr18", "asr19", "asr20", "asr21", \
"asr22", "asr23", "asr24", "asr25", "asr26", "asr27", \
"asr28", "asr29", "asr30", "asr31", \
@@ -185,6 +192,12 @@ struct value;
#undef FPS_REGNUM
#undef CPS_REGNUM
+/* #undef dummy regs */
+
+#undef PSTATE_REGNUM
+#undef TPC_REGNUM
+#undef TNPC_REGNUM
+
/* v9 misc. and priv. regs */
#define C0_REGNUM FP_MAX_REGNUM /* Start of control registers */
@@ -192,6 +205,7 @@ struct value;
#define NPC_REGNUM (C0_REGNUM + 1) /* Next PC */
#define CCR_REGNUM (C0_REGNUM + 2) /* Condition Code Register (%xcc,%icc) */
#define FSR_REGNUM (C0_REGNUM + 3) /* Floating Point State */
+#define FPS_REGNUM FSR_REGNUM
#define FPRS_REGNUM (C0_REGNUM + 4) /* Floating Point Registers State */
#define Y_REGNUM (C0_REGNUM + 5) /* Temp register for multiplication, etc. */
#define ASI_REGNUM (C0_REGNUM + 6) /* Alternate Space Identifier */
@@ -199,38 +213,51 @@ struct value;
#define TICK_REGNUM (C0_REGNUM + 8) /* Tick register */
#define PIL_REGNUM (C0_REGNUM + 9) /* Processor Interrupt Level */
#define PSTATE_REGNUM (C0_REGNUM + 10) /* Processor State */
+#define PS_REGNUM PSTATE_REGNUM
#define TSTATE_REGNUM (C0_REGNUM + 11) /* Trap State */
#define TBA_REGNUM (C0_REGNUM + 12) /* Trap Base Address */
+#define TBR_REGNUM TBA_REGNUM
#define TL_REGNUM (C0_REGNUM + 13) /* Trap Level */
#define TT_REGNUM (C0_REGNUM + 14) /* Trap Type */
#define TPC_REGNUM (C0_REGNUM + 15) /* Trap pc */
#define TNPC_REGNUM (C0_REGNUM + 16) /* Trap npc */
#define WSTATE_REGNUM (C0_REGNUM + 17) /* Window State */
#define CWP_REGNUM (C0_REGNUM + 18) /* Current Window Pointer */
+#define WIM_REGNUM CWP_REGNUM
#define CANSAVE_REGNUM (C0_REGNUM + 19) /* Savable Windows */
#define CANRESTORE_REGNUM (C0_REGNUM + 20) /* Restorable Windows */
#define CLEANWIN_REGNUM (C0_REGNUM + 21) /* Clean Windows */
#define OTHERWIN_REGNUM (C0_REGNUM + 22) /* Other Windows */
-#define ASR_REGNUM(n) (C0_REGNUM+(23-16)+(n)) /* Ancillary State Register
+#define GSR_REGNUM (C0_REGNUM + 23) /* Graphic State Register */
+#define ASR_REGNUM(n) (C0_REGNUM+(24-16)+(n)) /* Ancillary State Register
(n = 16...31) */
-#define ICC_REGNUM (C0_REGNUM + 39) /* 32 bit condition codes */
-#define XCC_REGNUM (C0_REGNUM + 40) /* 64 bit condition codes */
-#define FCC0_REGNUM (C0_REGNUM + 41) /* fp cc reg 0 */
-#define FCC1_REGNUM (C0_REGNUM + 42) /* fp cc reg 1 */
-#define FCC2_REGNUM (C0_REGNUM + 43) /* fp cc reg 2 */
-#define FCC3_REGNUM (C0_REGNUM + 44) /* fp cc reg 3 */
+#define CPS_REGNUM ASR_REGNUM(31)
+#define ICC_REGNUM (C0_REGNUM + 40) /* 32 bit condition codes */
+#define XCC_REGNUM (C0_REGNUM + 41) /* 64 bit condition codes */
+#define FCC0_REGNUM (C0_REGNUM + 42) /* fp cc reg 0 */
+#define FCC1_REGNUM (C0_REGNUM + 43) /* fp cc reg 1 */
+#define FCC2_REGNUM (C0_REGNUM + 44) /* fp cc reg 2 */
+#define FCC3_REGNUM (C0_REGNUM + 45) /* fp cc reg 3 */
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'.
Some of the registers aren't 64 bits, but it's a lot simpler just to assume
they all are (since most of them are). */
#undef REGISTER_BYTES
-#define REGISTER_BYTES (32*8+32*8+45*8)
+#define REGISTER_BYTES (32*8+32*8+46*8)
/* Index within `registers' of the first byte of the space for
register N. */
#undef REGISTER_BYTE
#define REGISTER_BYTE(N) \
+ ((N) < 32 ? (N)*8 + (is_sparc64 ? 0 : 4) \
+ : (N) < 64 ? 32*8 + ((N)-32)*4 \
+ : (N) < C0_REGNUM ? 32*8 + 32*4 + ((N)-64)*8 \
+ : 64*8 + ((N)-C0_REGNUM)*8 + (is_sparc64 ? 0 : 4))
+
+/* The same but even for 32bit process work with 64bit register N. */
+#undef REGISTER_BYTE64
+#define REGISTER_BYTE64(N) \
((N) < 32 ? (N)*8 \
: (N) < 64 ? 32*8 + ((N)-32)*4 \
: (N) < C0_REGNUM ? 32*8 + 32*4 + ((N)-64)*8 \
@@ -248,14 +275,21 @@ struct value;
#undef REGISTER_RAW_SIZE
#define REGISTER_RAW_SIZE(N) \
- ((N) < 32 ? 8 : (N) < 64 ? 4 : 8)
+ (is_sparc64 ? \
+ ((N) < 32 ? 8 : (N) < 64 ? 4 : 8) \
+ : (((N) >= 64 && (N) < C0_REGNUM) ? 8 : 4))
+
+/* The same but even for 32bit process work with 64bit register N. */
+#undef REGISTER_RAW_SIZE64
+#define REGISTER_RAW_SIZE64(N) \
+ ((N) < 32 ? 8 : (N) < 64 ? 4 : 8)
/* Number of bytes of storage in the program's representation
for register N. */
#undef REGISTER_VIRTUAL_SIZE
#define REGISTER_VIRTUAL_SIZE(N) \
- ((N) < 32 ? 8 : (N) < 64 ? 4 : 8)
+ REGISTER_RAW_SIZE(N)
/* Largest value REGISTER_RAW_SIZE can have. */
/* tm-sparc.h defines this as 8, but play it safe. */
@@ -274,19 +308,22 @@ struct value;
#undef REGISTER_VIRTUAL_TYPE
#define REGISTER_VIRTUAL_TYPE(N) \
- ((N) < 32 ? builtin_type_long_long \
+ ((N) < 32 ? (is_sparc64 ? builtin_type_long_long : builtin_type_int) \
: (N) < 64 ? builtin_type_float \
: (N) < 80 ? builtin_type_double \
- : builtin_type_long_long)
+ : (is_sparc64 ? builtin_type_long_long : builtin_type_int))
-/* We use to support both 32 bit and 64 bit pointers.
- We can't anymore because TARGET_PTR_BIT must now be a constant. */
+/* We use this to support both 32 bit and 64 bit pointers. */
#undef TARGET_PTR_BIT
-#define TARGET_PTR_BIT 64
+#define TARGET_PTR_BIT (is_sparc64 ? 64 : 32)
+
+/* The above will be at most 64 bits. This must be a constant. */
+#undef TARGET_MAX_PTR_BIT
+#define TARGET_MAX_PTR_BIT 64
/* Longs are 64 bits. */
#undef TARGET_LONG_BIT
-#define TARGET_LONG_BIT 64
+#define TARGET_LONG_BIT (is_sparc64 ? 64 : 32)
#undef TARGET_LONG_LONG_BIT
#define TARGET_LONG_LONG_BIT 64
@@ -308,23 +345,28 @@ struct value;
#undef USE_STRUCT_CONVENTION
-#define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > 32)
+#define USE_STRUCT_CONVENTION(gcc_p, type) \
+ (is_sparc64 ? TYPE_LENGTH (type) > 32 \
+ : generic_use_struct_convention (gcc_p, type))
#undef REG_STRUCT_HAS_ADDR
-#define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 32)
+#define REG_STRUCT_HAS_ADDR(gcc_p,type) (is_sparc64 ? TYPE_LENGTH (type) > 32 : gcc_p != 1)
/* Store the address of the place in which to copy the structure the
subroutine will return. This is called from call_function. */
/* FIXME: V9 uses %o0 for this. */
+#if 0
+/* FIXME!!! */
#undef STORE_STRUCT_RETURN
#define STORE_STRUCT_RETURN(ADDR, SP) \
{ target_write_memory ((SP)+(16*8), (char *)&(ADDR), 8); }
+#endif
/* Return number of bytes at start of arglist that are not really args. */
#undef FRAME_ARGS_SKIP
-#define FRAME_ARGS_SKIP 136
+#define FRAME_ARGS_SKIP (is_sparc64 ? 136 : 68)
\f
/* Offsets into jmp_buf.
FIXME: This was borrowed from the v8 stuff and will probably have to change
--- gdb/config/sparc/tm-sparc.h.jj Tue Feb 22 20:18:53 2000
+++ gdb/config/sparc/tm-sparc.h Fri Mar 17 16:09:14 2000
@@ -1,6 +1,6 @@
/* Target machine sub-parameters for SPARC, for GDB, the GNU debugger.
This is included by other tm-*.h files to define SPARC cpu-related info.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 2000
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@mcc.com)
@@ -25,6 +25,11 @@ struct frame_info;
struct type;
struct value;
+extern int gdb_is_sparc64;
+#ifndef is_sparc64
+#define is_sparc64 0
+#endif
+
#define TARGET_BYTE_ORDER BIG_ENDIAN
/* Floating point is IEEE compatible. */
@@ -181,6 +186,13 @@ extern CORE_ADDR sparc_pc_adjust PARAMS
#define FPS_REGNUM 70 /* Floating point status register */
#define CPS_REGNUM 71 /* Coprocessor status register */
+/* These are just to get sparc-linux-nat.c to compile without too many ifdefs.
+ Code using these will never be executed for 32bit binaries. */
+#define PSTATE_REGNUM 0
+#define TPC_REGNUM 0
+#define TNPC_REGNUM 0
+
+
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. On the sparc, `registers'
contains the ins and locals, even though they are saved on the
@@ -198,6 +210,7 @@ extern CORE_ADDR sparc_pc_adjust PARAMS
register N. */
/* ?? */
#define REGISTER_BYTE(N) ((N)*4)
+#define REGISTER_BYTE64(N) REGISTER_BYTE(N)
/* We need to override GET_SAVED_REGISTER so that we can deal with the way
outs change into ins in different frames. HAVE_REGISTER_WINDOWS can't
@@ -214,6 +227,7 @@ void sparc_get_saved_register PARAMS ((c
/* On the SPARC, all regs are 4 bytes. */
#define REGISTER_RAW_SIZE(N) (4)
+#define REGISTER_RAW_SIZE64(N) REGISTER_RAW_SIZE(N)
/* Number of bytes of storage in the program's representation
for register N. */
--- gdb/config/sparc/xm-linux64.h.jj Fri Oct 29 12:23:12 1999
+++ gdb/config/sparc/xm-linux64.h Fri Mar 17 16:09:14 2000
@@ -0,0 +1,38 @@
+/* Macro definitions for running gdb on a Sparc running Linux.
+ Copyright (C) 1989, 1993, 1994, 1995, 1996, 1998, 2000
+ Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef XM_SPARCLINUX64_H
+#define XM_SPARCLINUX64_H
+
+#include "sparc/xm-sparc.h"
+
+#define HAVE_TERMIOS
+/* This is the amount to subtract from u.u_ar0
+ to get the offset in the core file of the register values. */
+#define KERNEL_U_ADDR 0x0
+
+#define U_REGS_OFFSET 0
+
+#define NEED_POSIX_SETPGID
+
+/* Need R_OK etc, but USG isn't defined. */
+#include <unistd.h>
+
+#endif /* _XM_SPARCLINUX64_H */
--- gdb/sparc-nat.c.jj Wed Oct 6 01:08:51 1999
+++ gdb/sparc-nat.c Fri Mar 17 16:09:14 2000
@@ -26,11 +26,7 @@
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
-#ifdef __linux__
-#include <asm/reg.h>
-#else
#include <machine/reg.h>
-#endif
#include <sys/user.h>
/* We don't store all registers immediately when requested, since they
--- gdb/defs.h.jj Mon Mar 13 18:13:42 2000
+++ gdb/defs.h Fri Mar 17 16:09:14 2000
@@ -1012,6 +1012,11 @@ extern char *alloca ();
#define TARGET_BFD_VMA_BIT TARGET_PTR_BIT
#endif
+/* Maximum possible value of the above (must be constant). */
+#if !defined (TARGET_MAX_PTR_BIT)
+#define TARGET_MAX_PTR_BIT TARGET_PTR_BIT
+#endif
+
/* If we picked up a copy of CHAR_BIT from a configuration file
(which may get it by including <limits.h>) then use it to set
the number of bits in a host char. If not, use the same size
--- gdb/sparc-linux-nat.c.jj Fri Mar 17 08:37:50 2000
+++ gdb/sparc-linux-nat.c Fri Mar 17 16:23:01 2000
@@ -0,0 +1,581 @@
+/* Functions specific to running gdb native on a SPARC running Linux.
+ Copyright 1989, 1992, 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+#include "gdbcore.h"
+
+#include <signal.h>
+#include <sys/ptrace.h>
+#include <sys/wait.h>
+#include <asm/reg.h>
+#include <sys/user.h>
+#include <sys/syscall.h>
+
+/* We don't store all registers immediately when requested, since they
+ get sent over in large chunks anyway. Instead, we accumulate most
+ of the changes and send them over once. "deferred_stores" keeps
+ track of which sets of registers we have locally-changed copies of,
+ so we only need send the groups that have changed. */
+
+#define INT_REGS 1
+#define STACK_REGS 2
+#define FP_REGS 4
+
+/* libc passes only 4 arguments to the kernel, while for
+ READTEXT/WRITETEXT/READDATA/WRITEDATA we need 5. */
+
+int
+ptrace5(request, pid, taskaddr, len, addr)
+ int request, pid;
+ unsigned long taskaddr;
+ int len;
+ char *addr;
+{
+ return syscall(SYS_ptrace, request, pid, taskaddr, len, addr);
+}
+
+int
+child_xfer_memory (memaddr, myaddr, len, write, target)
+ CORE_ADDR memaddr;
+ char *myaddr;
+ int len;
+ int write;
+ struct target_ops *target ATTRIBUTE_UNUSED;
+{
+ errno = 0;
+ if (write)
+ ptrace5 (PTRACE_WRITETEXT, PIDGET(inferior_pid),
+ (unsigned long)memaddr, len, myaddr);
+ else
+ ptrace5 (PTRACE_READTEXT, PIDGET(inferior_pid),
+ (unsigned long)memaddr, len, myaddr);
+ if (errno)
+ return 0;
+
+ return len;
+}
+
+static void
+fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+
+/* Fetch one or more registers from the inferior. REGNO == -1 to get
+ them all. We actually fetch more than requested, when convenient,
+ marking them as valid so we won't fetch them again. */
+
+void
+fetch_inferior_registers (regno)
+ int regno;
+{
+ struct regs inferior_registers;
+ struct fp_status inferior_fp_registers;
+ int i;
+
+ /* We should never be called with deferred stores, because a prerequisite
+ for writing regs is to have fetched them all (PREPARE_TO_STORE), sigh. */
+ if (deferred_stores)
+ abort ();
+
+ DO_DEFERRED_STORES;
+
+ /* Global and Out regs are fetched directly, as well as the control
+ registers. If we're getting one of the in or local regs,
+ and the stack pointer has not yet been fetched,
+ we have to do that first, since they're found in memory relative
+ to the stack pointer. */
+ if (regno < O7_REGNUM /* including -1 */
+#ifdef GDB_PTRACE_REGS64
+ || regno >= PC_REGNUM
+#else
+ || regno >= Y_REGNUM
+#endif
+ || (!register_valid[SP_REGNUM] && regno < I7_REGNUM))
+ {
+ if (0 != ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_registers, 0))
+ perror ("ptrace_getregs");
+
+ *(long *)®isters[REGISTER_BYTE64 (G0_REGNUM)] = 0;
+ memcpy (®isters[REGISTER_BYTE64 (G1_REGNUM)], &inferior_registers.r_g1,
+ 15 * REGISTER_RAW_SIZE64 (G1_REGNUM));
+#ifdef GDB_PTRACE_REGS64
+ *(long *)®isters[REGISTER_BYTE64 (PSTATE_REGNUM)] = (inferior_registers.r_tstate >> 8) & 0x3ff;
+ *(long *)®isters[REGISTER_BYTE64 (CCR_REGNUM)] = (inferior_registers.r_tstate >> 32) & 0xff;
+ *(long *)®isters[REGISTER_BYTE64 (ASI_REGNUM)] = (inferior_registers.r_tstate >> 24) & 0xff;
+ *(long *)®isters[REGISTER_BYTE64 (CWP_REGNUM)] = inferior_registers.r_tstate & 0x1f;
+ *(long *)®isters[REGISTER_BYTE64 (PC_REGNUM)] = inferior_registers.r_tpc;
+ *(long *)®isters[REGISTER_BYTE64 (NPC_REGNUM)] = inferior_registers.r_tnpc;
+ *(long *)®isters[REGISTER_BYTE64 (FPRS_REGNUM)] = inferior_registers.r_fprs;
+#else
+ *(long *) ®isters[REGISTER_BYTE64 (PS_REGNUM)] = inferior_registers.r_ps;
+ *(long *) ®isters[REGISTER_BYTE64 (PC_REGNUM)] = inferior_registers.r_pc;
+ *(long *) ®isters[REGISTER_BYTE64 (NPC_REGNUM)] = inferior_registers.r_npc;
+#endif
+ *(long *) ®isters[REGISTER_BYTE64 (Y_REGNUM)] = inferior_registers.r_y;
+
+ for (i = G0_REGNUM; i <= O7_REGNUM; i++)
+ register_valid[i] = 1;
+ register_valid[Y_REGNUM] = 1;
+#ifdef GDB_PTRACE_REGS64
+ register_valid[PSTATE_REGNUM] = 1;
+ register_valid[CCR_REGNUM] = 1;
+ register_valid[ASI_REGNUM] = 1;
+ register_valid[CWP_REGNUM] = 1;
+ register_valid[FPRS_REGNUM] = 1;
+#else
+ register_valid[PS_REGNUM] = 1;
+#endif
+ register_valid[PC_REGNUM] = 1;
+ register_valid[NPC_REGNUM] = 1;
+#ifdef GDB_PTRACE_REGS64
+ /* XXX Lie for now. */
+ for(i = ASI_REGNUM; i < NUM_REGS; i++)
+ register_valid[i] = 1;
+#else
+ /* If we don't set these valid, read_register_bytes() rereads
+ all the regs every time it is called! FIXME. */
+ register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */
+ register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */
+ register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */
+#endif
+ }
+
+ /* Floating point registers */
+ if (regno == -1 ||
+ regno == FPS_REGNUM ||
+ (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31))
+ {
+ if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers,
+ 0))
+ perror ("ptrace_getfpregs");
+ memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+ sizeof inferior_fp_registers.fpu_fr);
+ memcpy (®isters[REGISTER_BYTE64 (FPS_REGNUM)],
+ &inferior_fp_registers.Fpu_fsr,
+ sizeof (FPU_FSR_TYPE));
+#ifdef GDB_PTRACE_REGS64
+ for (i = FP0_REGNUM; i <= FP0_REGNUM + 63; i++)
+ register_valid[i] = 1;
+#else
+ for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
+ register_valid[i] = 1;
+#endif
+ register_valid[FPS_REGNUM] = 1;
+ }
+
+ /* These regs are saved on the stack by the kernel. Only read them
+ all (16 ptrace calls!) if we really need them. */
+ if (regno == -1)
+ {
+ CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE64 (SP_REGNUM)];
+ if (is_sparc64 && (sp & 1))
+ sp += 2047;
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ if (!is_sparc64)
+ {
+ unsigned int buf[16];
+
+ target_read_memory (sp & 0xffffffffU, (char *)buf, 16 * 4);
+ for (i = 0; i < 16; i++)
+ *(long *)®isters[REGISTER_BYTE64 (L0_REGNUM + i)] = buf[i];
+ }
+ else
+#endif
+ target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)],
+ 16 * REGISTER_RAW_SIZE (L0_REGNUM));
+ for (i = L0_REGNUM; i <= I7_REGNUM; i++)
+ register_valid[i] = 1;
+ }
+ else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
+ {
+ CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE64 (SP_REGNUM)];
+ if (is_sparc64 && (sp & 1))
+ sp += 2047;
+ i = REGISTER_BYTE (regno);
+ if (register_valid[regno])
+ printf_unfiltered ("register %d valid and read\n", regno);
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ if (!is_sparc64)
+ {
+ target_read_memory (sp + (regno - L0_REGNUM) * 4,
+ ®isters[i], REGISTER_RAW_SIZE64 (regno));
+ *(int *)®isters[i-4] = 0;
+ }
+ else
+#endif
+ target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
+ ®isters[i], REGISTER_RAW_SIZE (regno));
+ register_valid[regno] = 1;
+ }
+}
+
+/* Store our register values back into the inferior.
+ If REGNO is -1, do this for all registers.
+ Otherwise, REGNO specifies which register (so we can save time). */
+
+void
+store_inferior_registers (regno)
+ int regno;
+{
+ struct regs inferior_registers;
+ struct fp_status inferior_fp_registers;
+ int wanna_store = INT_REGS + STACK_REGS + FP_REGS;
+
+ /* First decide which pieces of machine-state we need to modify.
+ Default for regno == -1 case is all pieces. */
+ if (regno >= 0)
+ {
+#ifdef GDB_PTRACE_REGS64
+ if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 64)
+#else
+ if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 32)
+#endif
+ {
+ wanna_store = FP_REGS;
+ }
+ else
+ {
+ if (regno == SP_REGNUM)
+ wanna_store = INT_REGS + STACK_REGS;
+ else if (regno < L0_REGNUM || regno > I7_REGNUM)
+ wanna_store = INT_REGS;
+ else if (regno == FPS_REGNUM)
+ wanna_store = FP_REGS;
+ else
+ wanna_store = STACK_REGS;
+ }
+ }
+
+ /* See if we're forcing the stores to happen now, or deferring. */
+ if (regno == -2)
+ {
+ wanna_store = deferred_stores;
+ deferred_stores = 0;
+ }
+ else
+ {
+ if (wanna_store == STACK_REGS)
+ {
+ /* Fall through and just store one stack reg. If we deferred
+ it, we'd have to store them all, or remember more info. */
+ }
+ else
+ {
+ deferred_stores |= wanna_store;
+ return;
+ }
+ }
+
+ if (wanna_store & STACK_REGS)
+ {
+ CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE64 (SP_REGNUM)];
+
+ if (is_sparc64 && (sp & 1))
+ sp += 2047;
+
+ if (regno < 0 || regno == SP_REGNUM)
+ {
+ if (!register_valid[L0_REGNUM + 5])
+ abort ();
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ if (!is_sparc64)
+ {
+ unsigned int buf[16];
+ int i;
+
+ for (i = 0; i < 16; i++)
+ buf[i] = *(int *)®isters[REGISTER_BYTE (L0_REGNUM + i)];
+ target_write_memory (sp & 0xffffffffU, (char *)buf, 16 * 4);
+ }
+ else
+#endif
+ target_write_memory (sp,
+ ®isters[REGISTER_BYTE (L0_REGNUM)],
+ 16 * REGISTER_RAW_SIZE (L0_REGNUM));
+ }
+ else
+ {
+ if (!register_valid[regno])
+ abort ();
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ if (!is_sparc64)
+ target_write_memory (sp + (regno - L0_REGNUM) * 4,
+ ®isters[REGISTER_BYTE (regno)], 4);
+ else
+#endif
+ target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
+ ®isters[REGISTER_BYTE (regno)],
+ REGISTER_RAW_SIZE (regno));
+ }
+
+ }
+
+ if (wanna_store & INT_REGS)
+ {
+ if (!register_valid[G1_REGNUM])
+ abort ();
+
+ memcpy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE64 (G1_REGNUM)],
+ 15 * REGISTER_RAW_SIZE64 (G1_REGNUM));
+
+#ifdef GDB_PTRACE_REGS64
+ inferior_registers.r_tstate =
+ ((*(long *) ®isters[REGISTER_BYTE64 (CWP_REGNUM)]) & 0x1f) |
+ (((*(long *) ®isters[REGISTER_BYTE64 (PSTATE_REGNUM)]) & 0x3ff) << 8) |
+ (((*(long *) ®isters[REGISTER_BYTE64 (ASI_REGNUM)]) & 0xff) << 24) |
+ (((*(long *) ®isters[REGISTER_BYTE64 (CCR_REGNUM)]) & 0xff) << 32);
+ inferior_registers.r_tpc =
+ *(long *) ®isters[REGISTER_BYTE64 (PC_REGNUM)];
+ inferior_registers.r_tnpc =
+ *(long *) ®isters[REGISTER_BYTE64 (NPC_REGNUM)];
+#else
+ inferior_registers.r_ps =
+ *(long *) ®isters[REGISTER_BYTE (PS_REGNUM)];
+ inferior_registers.r_pc =
+ *(long *) ®isters[REGISTER_BYTE (PC_REGNUM)];
+ inferior_registers.r_npc =
+ *(long *) ®isters[REGISTER_BYTE (NPC_REGNUM)];
+#endif
+ inferior_registers.r_y =
+ *(long *) ®isters[REGISTER_BYTE64 (Y_REGNUM)];
+
+ if (0 != ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_registers, 0))
+ perror ("ptrace_setregs");
+ }
+
+ if (wanna_store & FP_REGS)
+ {
+ if (!register_valid[FP0_REGNUM + 9])
+ abort ();
+ memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)],
+ sizeof inferior_fp_registers.fpu_fr);
+ memcpy (&inferior_fp_registers.Fpu_fsr,
+ ®isters[REGISTER_BYTE64 (FPS_REGNUM)], sizeof (FPU_FSR_TYPE));
+ if (0 !=
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0))
+ perror ("ptrace_setfpregs");
+ }
+}
+
+
+static void
+fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ CORE_ADDR ignore ATTRIBUTE_UNUSED; /* reg addr, unused in this version */
+{
+ if (which == 0) {
+
+ /* Integer registers */
+
+#if !defined (GDB_TARGET_IS_SPARC64)
+#define gregs ((struct regs *)core_reg_sect)
+#else
+ struct sparc_core_regs32 {
+ unsigned int r_psr, r_pc, r_npc, r_y;
+ unsigned int r_g1, r_g2, r_g3, r_g4, r_g5, r_g6, r_g7;
+ unsigned int r_o0, r_o1, r_o2, r_o4, r_o5, r_o6, r_o7;
+ };
+#define gregs ((struct sparc_core_regs32 *)core_reg_sect)
+#define gregs64 ((struct regs *)core_reg_sect)
+#endif
+
+ /* G0 *always* holds 0. */
+ *(long *) ®isters[REGISTER_BYTE64 (G0_REGNUM)] = 0;
+
+ /* The globals and output registers. */
+ if (!is_sparc64)
+ {
+ if (core_reg_size == 38*sizeof(int))
+ {
+ /* Integer registers in Solaris-like layout (e.g. in Linux 2.1.12x+) */
+
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ int i;
+
+ /* The globals and output registers. */
+ for (i = 0; i < 31; i++)
+ *(long *) ®isters[REGISTER_BYTE64 (G1_REGNUM + i)] = ((int *)core_reg_sect)[i + 1];
+ *(long *) ®isters[REGISTER_BYTE64 (CWP_REGNUM)] = ((int *)core_reg_sect)[32] & 0x1f;
+ *(long *) ®isters[REGISTER_BYTE64 (CCR_REGNUM)] = (((int *)core_reg_sect)[32] >> 20) & 0xf;
+#else
+ /* The globals and output registers. */
+ memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], ((int *)core_reg_sect)+1,
+ 31 * REGISTER_RAW_SIZE (G1_REGNUM));
+ *(long *)®isters[REGISTER_BYTE64 (PS_REGNUM)] = ((int *)core_reg_sect)[32];
+#endif
+ *(long *)®isters[REGISTER_BYTE64 (PC_REGNUM)] = ((int *)core_reg_sect)[33];
+ *(long *)®isters[REGISTER_BYTE (NPC_REGNUM)] = ((int *)core_reg_sect)[34];
+ *(long *)®isters[REGISTER_BYTE (Y_REGNUM)] = ((int *)core_reg_sect)[35];
+ return;
+ }
+
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ int i;
+
+ for (i = 0; i < 15; i++)
+ *(long *) ®isters[REGISTER_BYTE64 (G1_REGNUM + i)] =
+ *((&gregs->r_g1)+i);
+ *(long *) ®isters[REGISTER_BYTE64 (CWP_REGNUM)] = gregs->r_psr & 0x1f;
+ *(long *) ®isters[REGISTER_BYTE64 (CCR_REGNUM)] = (gregs->r_psr >> 20) & 0xf;
+#else
+ memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1,
+ 15 * REGISTER_RAW_SIZE (G1_REGNUM));
+ *(long *) ®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_psr;
+#endif
+ *(long *) ®isters[REGISTER_BYTE64 (PC_REGNUM)] = gregs->r_pc;
+ *(long *) ®isters[REGISTER_BYTE64 (NPC_REGNUM)] = gregs->r_npc;
+ *(long *) ®isters[REGISTER_BYTE64 (Y_REGNUM)] = gregs->r_y;
+ }
+#ifdef GDB_TARGET_IS_SPARC64
+ else
+ {
+ memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs64->r_g1,
+ 15 * REGISTER_RAW_SIZE (G1_REGNUM));
+ *(long *)®isters[REGISTER_BYTE64 (PSTATE_REGNUM)] = (gregs64->r_tstate >> 8) & 0x3ff;
+ *(long *)®isters[REGISTER_BYTE64 (CCR_REGNUM)] = (gregs64->r_tstate >> 32) & 0xff;
+ *(long *)®isters[REGISTER_BYTE64 (ASI_REGNUM)] = (gregs64->r_tstate >> 24) & 0xff;
+ *(long *)®isters[REGISTER_BYTE64 (CWP_REGNUM)] = gregs64->r_tstate & 0x1f;
+ *(long *)®isters[REGISTER_BYTE64 (PC_REGNUM)] = gregs64->r_tpc;
+ *(long *)®isters[REGISTER_BYTE64 (NPC_REGNUM)] = gregs64->r_tnpc;
+ *(long *)®isters[REGISTER_BYTE64 (FPRS_REGNUM)] = gregs64->r_fprs;
+ *(long *) ®isters[REGISTER_BYTE64 (Y_REGNUM)] = gregs64->r_y;
+ }
+#endif
+
+ /* My best guess at where to get the locals and input
+ registers is exactly where they usually are, right above
+ the stack pointer. If the core dump was caused by a bus error
+ from blowing away the stack pointer (as is possible) then this
+ won't work, but it's worth the try. */
+ {
+ long sp;
+ int ret;
+
+ sp = *(long *) ®isters[REGISTER_BYTE64 (SP_REGNUM)];
+ if (is_sparc64 && (sp & 1))
+ sp += 2047;
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ if (!is_sparc64)
+ {
+ unsigned int buf[16];
+ int i;
+
+ ret = target_read_memory (sp & 0xffffffffU, (char *)buf, 16 * 4);
+ for (i = 0; i < 16; i++)
+ *(long *)®isters[REGISTER_BYTE64 (L0_REGNUM + i)] = buf[i];
+ }
+ else
+#endif
+ ret = target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)],
+ 16 * REGISTER_RAW_SIZE (L0_REGNUM));
+ if (ret != 0)
+ {
+ /* fprintf_unfiltered so user can still use gdb */
+ fprintf_unfiltered (gdb_stderr,
+ "Couldn't read input and local registers from core file\n");
+ }
+ }
+ }
+ else if (which == 2)
+ {
+
+ /* Floating point registers */
+
+#if !defined (GDB_TARGET_IS_SPARC64)
+#define fpuregs ((struct fpu *) core_reg_sect)
+ if (core_reg_size >= sizeof (struct fpu))
+ {
+ memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs->fpu_regs,
+ sizeof (fpuregs->fpu_regs));
+ memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr,
+ sizeof (FPU_FSR_TYPE));
+ return;
+ }
+#else
+ if (is_sparc64)
+ {
+ struct sparc_core_fpu64
+ {
+ unsigned long fpu64_regs[32], fpu64_fsr, fpu64_gsr, fpu64_fprs;
+ };
+#define fpuregs64 ((struct sparc_core_fpu64 *) core_reg_sect)
+ if (core_reg_size >= sizeof (struct sparc_core_fpu64))
+ {
+ memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs64->fpu64_regs,
+ sizeof (fpuregs64->fpu64_regs));
+ memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs64->fpu64_fsr,
+ sizeof (fpuregs64->fpu64_fsr));
+ memcpy (®isters[REGISTER_BYTE (GSR_REGNUM)], &fpuregs64->fpu64_gsr,
+ sizeof (fpuregs64->fpu64_gsr));
+ return;
+ }
+ }
+ else
+ {
+ struct sparc_core_fpu32
+ {
+ unsigned int fpu32_regs[32];
+ unsigned int __unused;
+ unsigned int fpu32_fsr;
+ unsigned char fpu32_qcnt;
+ unsigned char fpu32_q_entrysize;
+ unsigned char fpu32_en;
+ unsigned int fpu32_q[64];
+ };
+#define fpuregs32 ((struct sparc_core_fpu32 *) core_reg_sect)
+ if (core_reg_size >= sizeof (struct sparc_core_fpu32))
+ {
+ memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs32->fpu32_regs,
+ sizeof (fpuregs32->fpu32_regs));
+ *(long *)®isters[REGISTER_BYTE64 (FPS_REGNUM)] = 0;
+ memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs32->fpu32_fsr,
+ sizeof (fpuregs32->fpu32_fsr));
+ return;
+ }
+ }
+#endif
+ fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
+ }
+}
+\f
+
+/* Register that we are able to handle sparc core file formats.
+ FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns sparc_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+void
+_initialize_core_sparc ()
+{
+ add_core_fns (&sparc_core_fns);
+}
--- gdb/blockframe.c.jj Wed Dec 22 22:45:03 1999
+++ gdb/blockframe.c Fri Mar 17 16:09:14 2000
@@ -1000,7 +1000,7 @@ sigtramp_saved_pc (frame)
struct frame_info *frame;
{
CORE_ADDR sigcontext_addr;
- char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+ char buf[TARGET_MAX_PTR_BIT / TARGET_CHAR_BIT];
int ptrbytes = TARGET_PTR_BIT / TARGET_CHAR_BIT;
int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT;
--- gdb/configure.host.jj Wed Dec 22 22:45:03 1999
+++ gdb/configure.host Fri Mar 17 16:09:14 2000
@@ -20,7 +20,7 @@ m88*) gdb_host_cpu=m88k ;;
# OBSOLETE np1) gdb_host_cpu=gould ;;
# OBSOLETE pyramid) gdb_host_cpu=pyr ;;
powerpc*) gdb_host_cpu=powerpc ;;
-sparc64) gdb_host_cpu=sparc ;;
+sparc*) gdb_host_cpu=sparc ;;
*) gdb_host_cpu=$host_cpu ;;
esac
@@ -155,6 +155,7 @@ sparc-*-solaris2*) gdb_host=sun4sol2 ;;
sparc-*-sunos4*) gdb_host=sun4os4 ;;
sparc-*-sunos5*) gdb_host=sun4sol2 ;;
sparc-*-*) gdb_host=sun4os4 ;;
+sparc64-*-linux*) gdb_host=linux64 ;;
sparc64-*-*) gdb_host=sun4sol2 ;;
strongarm-*-*) gdb_host=arm ;;
--- gdb/solib.c.jj Mon Mar 6 19:04:56 2000
+++ gdb/solib.c Fri Mar 17 16:09:14 2000
@@ -717,7 +717,7 @@ elf_locate_base ()
#ifdef DT_MIPS_RLD_MAP
else if (dyn_tag == DT_MIPS_RLD_MAP)
{
- char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+ char pbuf[TARGET_MAX_PTR_BIT / HOST_CHAR_BIT];
/* DT_MIPS_RLD_MAP contains a pointer to the address
of the dynamic link structure. */
--- gdb/sparc-tdep.c.jj Wed Oct 6 01:08:51 1999
+++ gdb/sparc-tdep.c Fri Mar 17 16:09:14 2000
@@ -1,5 +1,5 @@
/* Target-dependent code for the SPARC for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
Free Software Foundation, Inc.
This file is part of GDB.
@@ -42,12 +42,6 @@
#define SPARC_HAS_FPU 1
#endif
-#ifdef GDB_TARGET_IS_SPARC64
-#define FP_REGISTER_BYTES (64 * 4)
-#else
-#define FP_REGISTER_BYTES (32 * 4)
-#endif
-
/* If not defined, assume 32 bit sparc. */
#ifndef FP_MAX_REGNUM
#define FP_MAX_REGNUM (FP0_REGNUM + 32)
@@ -73,6 +67,15 @@ int deferred_stores = 0; /* Cumulates st
int bi_endian = 0;
+/* Are we debugging 64bit code or 32bit? */
+
+#ifdef GDB_TARGET_IS_SPARC64
+int gdb_is_sparc64 = 1;
+#else
+int gdb_is_sparc64 = 0;
+#endif
+
+#define FP_REGISTER_BYTES (is_sparc64 ? 64 * 4 : 32 * 4)
/* Fetch a single instruction. Even on bi-endian machines
such as sparc86x, instructions are always big-endian. */
@@ -122,10 +125,7 @@ fetch_instruction (pc)
typedef enum
{
- Error, not_branch, bicc, bicca, ba, baa, ticc, ta,
-#ifdef GDB_TARGET_IS_SPARC64
- done_retry
-#endif
+ Error, not_branch, bicc, bicca, ba, baa, ticc, ta, done_retry
}
branch_type;
@@ -187,13 +187,11 @@ sparc_software_single_step (ignore, inse
brktrg = 1;
target_insert_breakpoint (target, break_mem[2]);
}
-#ifdef GDB_TARGET_IS_SPARC64
else if (br == done_retry)
{
brktrg = 1;
target_insert_breakpoint (target, break_mem[2]);
}
-#endif
}
else
{
@@ -251,10 +249,8 @@ sparc_init_extra_frame_info (fromleaf, f
/* Should we adjust for stack bias here? */
get_saved_register (buf, 0, 0, fi, FP_REGNUM, 0);
fi->frame = extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM));
-#ifdef GDB_TARGET_IS_SPARC64
- if (fi->frame & 1)
+ if (is_sparc64 && fi->frame & 1)
fi->frame += 2047;
-#endif
}
}
@@ -292,10 +288,8 @@ sparc_init_extra_frame_info (fromleaf, f
/* Overwrite the frame's address with the value in %i7. */
get_saved_register (buf, 0, 0, fi, I7_REGNUM, 0);
fi->frame = extract_address (buf, REGISTER_RAW_SIZE (I7_REGNUM));
-#ifdef GDB_TARGET_IS_SPARC64
- if (fi->frame & 1)
+ if (is_sparc64 && fi->frame & 1)
fi->frame += 2047;
-#endif
/* Record where the fp got saved. */
fi->fp_addr = fi->frame + fi->sp_offset + X_SIMM13 (insn);
@@ -384,7 +378,7 @@ sparc_frame_saved_pc (frame)
#endif
CORE_ADDR sigcontext_addr;
- char scbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+ char scbuf[TARGET_MAX_PTR_BIT / HOST_CHAR_BIT];
int saved_pc_offset = SIGCONTEXT_PC_OFFSET;
char *name = NULL;
@@ -616,9 +610,7 @@ isbranch (instruction, addr, target)
|| X_OP2 (instruction) == 1
|| X_OP2 (instruction) == 3
|| X_OP2 (instruction) == 5
-#ifndef GDB_TARGET_IS_SPARC64
- || X_OP2 (instruction) == 7
-#endif
+ || (!is_sparc64 && X_OP2 (instruction) == 7)
))
{
if (X_COND (instruction) == 8)
@@ -629,9 +621,7 @@ isbranch (instruction, addr, target)
{
case 2:
case 6:
-#ifndef GDB_TARGET_IS_SPARC64
case 7:
-#endif
offset = 4 * X_DISP22 (instruction);
break;
case 1:
@@ -644,8 +634,7 @@ isbranch (instruction, addr, target)
}
*target = addr + offset;
}
-#ifdef GDB_TARGET_IS_SPARC64
- else if (X_OP (instruction) == 2
+ else if (is_sparc64 && X_OP (instruction) == 2
&& X_OP3 (instruction) == 62)
{
if (X_FCN (instruction) == 0)
@@ -661,7 +650,6 @@ isbranch (instruction, addr, target)
val = done_retry;
}
}
-#endif
return val;
}
@@ -753,11 +741,10 @@ sparc_get_saved_register (raw_buffer, op
else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32)
addr = frame1->frame + (regnum - FP0_REGNUM) * 4
- (FP_REGISTER_BYTES);
-#ifdef GDB_TARGET_IS_SPARC64
- else if (regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
+ else if (is_sparc64
+ && regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
addr = frame1->frame + 32 * 4 + (regnum - FP0_REGNUM - 32) * 8
- (FP_REGISTER_BYTES);
-#endif
#endif /* FP0_REGNUM */
else if (regnum >= Y_REGNUM && regnum < NUM_REGS)
addr = frame1->frame + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
@@ -842,11 +829,7 @@ sparc_get_saved_register (raw_buffer, op
/* Definitely see tm-sparc.h for more doc of the frame format here. */
-#ifdef GDB_TARGET_IS_SPARC64
-#define DUMMY_REG_SAVE_OFFSET (128 + 16)
-#else
-#define DUMMY_REG_SAVE_OFFSET 0x60
-#endif
+#define DUMMY_REG_SAVE_OFFSET (is_sparc64 ? 128 + 16 : 0x60)
/* See tm-sparc.h for how this is calculated. */
#ifdef FP0_REGNUM
@@ -866,18 +849,21 @@ sparc_push_dummy_frame ()
old_sp = sp = read_sp ();
-#ifdef GDB_TARGET_IS_SPARC64
- /* PC, NPC, CCR, FSR, FPRS, Y, ASI */
- read_register_bytes (REGISTER_BYTE (PC_REGNUM), ®ister_temp[0],
- REGISTER_RAW_SIZE (PC_REGNUM) * 7);
- read_register_bytes (REGISTER_BYTE (PSTATE_REGNUM), ®ister_temp[8],
- REGISTER_RAW_SIZE (PSTATE_REGNUM));
- /* FIXME: not sure what needs to be saved here. */
-#else
- /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */
- read_register_bytes (REGISTER_BYTE (Y_REGNUM), ®ister_temp[0],
- REGISTER_RAW_SIZE (Y_REGNUM) * 8);
-#endif
+ if (is_sparc64)
+ {
+ /* PC, NPC, CCR, FSR, FPRS, Y, ASI */
+ read_register_bytes (REGISTER_BYTE (PC_REGNUM), ®ister_temp[0],
+ REGISTER_RAW_SIZE (PC_REGNUM) * 7);
+ read_register_bytes (REGISTER_BYTE (PSTATE_REGNUM), ®ister_temp[8],
+ REGISTER_RAW_SIZE (PSTATE_REGNUM));
+ /* FIXME: not sure what needs to be saved here. */
+ }
+ else
+ {
+ /* Y, PS, WIM, TBR, PC, NPC, FPS, CPS regs */
+ read_register_bytes (REGISTER_BYTE (Y_REGNUM), ®ister_temp[0],
+ REGISTER_RAW_SIZE (Y_REGNUM) * 8);
+ }
read_register_bytes (REGISTER_BYTE (O0_REGNUM),
®ister_temp[8 * SPARC_INTREG_SIZE],
@@ -996,28 +982,30 @@ sparc_frame_find_saved_regs (fi, saved_r
saved_regs_addr->regs[regnum] =
frame_addr + (regnum - FP0_REGNUM) * 4
- DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
-#ifdef GDB_TARGET_IS_SPARC64
- for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
- saved_regs_addr->regs[regnum] =
- frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
- - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
-#endif
+ if (is_sparc64)
+ for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
+ saved_regs_addr->regs[regnum] =
+ frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
+ - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#endif /* FP0_REGNUM */
-#ifdef GDB_TARGET_IS_SPARC64
- for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
+ if (is_sparc64)
{
- saved_regs_addr->regs[regnum] =
- frame_addr + (regnum - PC_REGNUM) * SPARC_INTREG_SIZE
- - DUMMY_STACK_REG_BUF_SIZE;
+ for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
+ {
+ saved_regs_addr->regs[regnum] =
+ frame_addr + (regnum - PC_REGNUM) * SPARC_INTREG_SIZE
+ - DUMMY_STACK_REG_BUF_SIZE;
+ }
+ saved_regs_addr->regs[PSTATE_REGNUM] =
+ frame_addr + 8 * SPARC_INTREG_SIZE - DUMMY_STACK_REG_BUF_SIZE;
+ }
+ else
+ {
+ for (regnum = Y_REGNUM; regnum < NUM_REGS; regnum++)
+ saved_regs_addr->regs[regnum] =
+ frame_addr + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
+ - DUMMY_STACK_REG_BUF_SIZE;
}
- saved_regs_addr->regs[PSTATE_REGNUM] =
- frame_addr + 8 * SPARC_INTREG_SIZE - DUMMY_STACK_REG_BUF_SIZE;
-#else
- for (regnum = Y_REGNUM; regnum < NUM_REGS; regnum++)
- saved_regs_addr->regs[regnum] =
- frame_addr + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
- - DUMMY_STACK_REG_BUF_SIZE;
-#endif
frame_addr = fi->bottom ?
fi->bottom : read_sp ();
}
@@ -1101,18 +1089,16 @@ sparc_pop_frame ()
write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
raw_buffer, FP_REGISTER_BYTES);
}
-#ifndef GDB_TARGET_IS_SPARC64
- if (fsr.regs[FPS_REGNUM])
+ if (!is_sparc64 && fsr.regs[FPS_REGNUM])
{
read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4);
write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4);
}
- if (fsr.regs[CPS_REGNUM])
+ if (!is_sparc64 && fsr.regs[CPS_REGNUM])
{
read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4);
write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4);
}
-#endif
#endif /* FP0_REGNUM */
if (fsr.regs[G1_REGNUM])
{
@@ -1160,10 +1146,8 @@ sparc_pop_frame ()
locals from the registers array, so we need to muck with the
registers array. */
sp = fsr.regs[SP_REGNUM];
-#ifdef GDB_TARGET_IS_SPARC64
- if (sp & 1)
+ if (is_sparc64 && (sp & 1))
sp += 2047;
-#endif
read_memory (sp, reg_temp, SPARC_INTREG_SIZE * 16);
/* Restore the out registers.
@@ -1174,10 +1158,8 @@ sparc_pop_frame ()
write_register_bytes (REGISTER_BYTE (L0_REGNUM), reg_temp,
SPARC_INTREG_SIZE * 16);
}
-#ifndef GDB_TARGET_IS_SPARC64
- if (fsr.regs[PS_REGNUM])
+ if (!is_sparc64 && fsr.regs[PS_REGNUM])
write_register (PS_REGNUM, read_memory_integer (fsr.regs[PS_REGNUM], 4));
-#endif
if (fsr.regs[Y_REGNUM])
write_register (Y_REGNUM, read_memory_integer (fsr.regs[Y_REGNUM], REGISTER_RAW_SIZE (Y_REGNUM)));
if (fsr.regs[PC_REGNUM])
@@ -1897,17 +1879,15 @@ sparc_fix_call_dummy (dummy, pc, fun, va
store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4,
TYPE_LENGTH (value_type) & 0x1fff);
-#ifndef GDB_TARGET_IS_SPARC64
/* If this is not a simulator target, change the first four instructions
of the call dummy to NOPs. Those instructions include a 'save'
instruction and are designed to work around problems with register
window flushing in the simulator. */
- if (strcmp (target_shortname, "sim") != 0)
+ if (!is_sparc64 && strcmp (target_shortname, "sim") != 0)
{
for (i = 0; i < 4; i++)
store_unsigned_integer (dummy + (i * 4), 4, 0x01000000);
}
-#endif
/* If this is a bi-endian target, GDB has written the call dummy
in little-endian order. We must byte-swap it back to big-endian. */
@@ -1934,6 +1914,18 @@ sparc_target_architecture_hook (ap)
{
int i, j;
+#ifdef GDB_TARGET_IS_SPARC_BI_ARCH
+ switch (ap->mach)
+ {
+ case bfd_mach_sparc_v9:
+ case bfd_mach_sparc_v9a:
+ gdb_is_sparc64 = 1;
+ break;
+ default:
+ gdb_is_sparc64 = 0;
+ break;
+ }
+#endif
if (ap->mach == bfd_mach_sparc_sparclite_le)
{
if (TARGET_BYTE_ORDER_SELECTABLE_P)
@@ -1952,14 +1944,6 @@ sparc_target_architecture_hook (ap)
}
\f
-void
-_initialize_sparc_tdep ()
-{
- tm_print_insn = gdb_print_insn_sparc;
- tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
- target_architecture_hook = sparc_target_architecture_hook;
-}
-
#ifdef GDB_TARGET_IS_SPARC64
@@ -1970,7 +1954,7 @@ sparc64_read_sp ()
{
CORE_ADDR sp = read_register (SP_REGNUM);
- if (sp & 1)
+ if (is_sparc64 && (sp & 1))
sp += 2047;
return sp;
}
@@ -1980,7 +1964,7 @@ sparc64_read_fp ()
{
CORE_ADDR fp = read_register (FP_REGNUM);
- if (fp & 1)
+ if (is_sparc64 && (fp & 1))
fp += 2047;
return fp;
}
@@ -1990,7 +1974,7 @@ sparc64_write_sp (val)
CORE_ADDR val;
{
CORE_ADDR oldsp = read_register (SP_REGNUM);
- if (oldsp & 1)
+ if (is_sparc64 && (oldsp & 1))
write_register (SP_REGNUM, val - 2047);
else
write_register (SP_REGNUM, val);
@@ -2001,7 +1985,7 @@ sparc64_write_fp (val)
CORE_ADDR val;
{
CORE_ADDR oldfp = read_register (FP_REGNUM);
- if (oldfp & 1)
+ if (is_sparc64 && (oldfp & 1))
write_register (FP_REGNUM, val - 2047);
else
write_register (FP_REGNUM, val);
@@ -2022,6 +2006,10 @@ sp64_push_arguments (nargs, args, sp, st
int regnum = 0;
CORE_ADDR tempsp;
+ if (!is_sparc64)
+ return sparc_push_arguments (nargs, args, sp, struct_return,
+ struct_retaddr);
+
sp = (sp & ~(((unsigned long) TYPE_LENGTH (builtin_type_long)) - 1UL));
/* Figure out how much space we'll need. */
@@ -2094,6 +2082,12 @@ sparc64_extract_return_value (type, regb
int typelen = TYPE_LENGTH (type);
int regsize = REGISTER_RAW_SIZE (O0_REGNUM);
+ if (!is_sparc64)
+ {
+ sparc_extract_return_value (type, regbuf, valbuf);
+ return;
+ }
+
if (TYPE_CODE (type) == TYPE_CODE_FLT && SPARC_HAS_FPU)
{
memcpy (valbuf, ®buf[REGISTER_BYTE (FP0_REGNUM)], typelen);
@@ -2146,3 +2140,11 @@ sparc64_extract_return_value (type, regb
#endif
+
+void
+_initialize_sparc_tdep ()
+{
+ tm_print_insn = gdb_print_insn_sparc;
+ tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
+ target_architecture_hook = sparc_target_architecture_hook;
+}
--- gdb/jv-valprint.c.jj Wed Feb 2 01:21:08 2000
+++ gdb/jv-valprint.c Fri Mar 17 16:09:14 2000
@@ -99,7 +99,7 @@ java_value_print (val, stream, format, p
while (i < length && things_printed < print_max)
{
- char buf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+ char buf[TARGET_MAX_PTR_BIT / HOST_CHAR_BIT];
fputs_filtered (", ", stream);
wrap_here (n_spaces (2));
--- gdb/configure.tgt.jj Thu Feb 24 04:31:45 2000
+++ gdb/configure.tgt Fri Mar 17 16:09:14 2000
@@ -269,7 +269,8 @@ sparc86x-*-*) gdb_target=sparclite ;;
# should return. Work is still needed to get gdb to print the 64 bit
# regs (some of which are usable in v8plus) so sp64sol.mt hasn't been
# deleted though presumably it should be eventually.
-#sparc64-*-solaris2*) gdb_target=sp64sol2 ;;
+#sparcv9-*-solaris2*) gdb_target=sp64sol2 ;;
+sparc64-*-linux*) gdb_target=linux64 ;;
sparc64-*-*) gdb_target=sp64 ;;
# OBSOLETE tahoe-*-*) gdb_target=tahoe ;;
--- gdb/lin-thread.c.jj Wed Feb 9 09:52:46 2000
+++ gdb/lin-thread.c Fri Mar 17 16:09:14 2000
@@ -658,7 +658,7 @@ init_thread_db_library ()
static struct cleanup *
save_inferior_pid (void)
{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
+#if TARGET_MAX_PTR_BIT > TARGET_INT_BIT
return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid));
#else
return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
@@ -668,7 +668,7 @@ save_inferior_pid (void)
static void
restore_inferior_pid (void *saved_pid)
{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
+#if TARGET_MAX_PTR_BIT > TARGET_INT_BIT
inferior_pid = (int) ((long) saved_pid);
#else
inferior_pid = (int) saved_pid;
--- gdb/linux-thread.c.jj Thu Feb 10 05:53:26 2000
+++ gdb/linux-thread.c Fri Mar 17 16:09:14 2000
@@ -381,7 +381,7 @@ static void
restore_inferior_pid (arg)
void *arg;
{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
+#if TARGET_MAX_PTR_BIT > TARGET_INT_BIT
inferior_pid = (int) ((long) arg);
#else
inferior_pid = (int) arg;
@@ -392,7 +392,7 @@ restore_inferior_pid (arg)
static struct cleanup *
save_inferior_pid ()
{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
+#if TARGET_MAX_PTR_BIT > TARGET_INT_BIT
return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid));
#else
return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
Jakub
From ac131313@cygnus.com Tue May 23 00:50:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Michael Snyder <msnyder@cygnus.com>, GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [RFA/C] IRIX 6.5 with GCC build fixes
Date: Tue, 23 May 2000 00:50:00 -0000
Message-id: <392A381F.43B694EF@cygnus.com>
References: <39164CF0.ABDA46D4@cygnus.com>
X-SW-Source: 2000-05/msg00339.html
Content-length: 908
Andrew Cagney wrote:
>
> Michael,
>
> Does the below look ok? It is to fix the IRIX 6.5 build problems. With
> it applied, gdb starts but I'm not clear on testsuite results - dejagnu
> fails when trying to fork. A mindless play with GDB does appear to work
> though.
>
> Its for both GDB 5.0 and the trunk.
>
> Andrew
>
> ------------------------------------------------------------------------
> Mon May 8 14:49:51 2000 Andrew Cagney <cagney@b1.cygnus.com>
>
> From Michael Paddon <mmpp@esec.com.au>:
> * configure.in (AC_CHECK_HEADERS): Check for <sys/user.h>.
> * configure: Re-generate.
> * proc-api.c: Only include <sys/user.h> when available.
> (ioctl_table): Check that PIOCGETPR and PIOCGETU are defined.
>
> * TODO, README: Update. Mention that GDB 5 needs GCC on IRIX.
FYI,
I've now also applied this to the trunk.
Andrew
From kettenis@wins.uva.nl Tue May 23 01:48:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: msnyder@cygnus.com
Cc: kevinb@cygnus.com, aoliva@cygnus.com, gdb-patches@sourceware.cygnus.com, taylor@cygnus.com
Subject: Re: GDB 5.0 won't build on GNU/Linux/sparc
Date: Tue, 23 May 2000 01:48:00 -0000
Message-id: <200005230847.e4N8lql09626@delius.kettenis.local>
References: <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br> <1000523021152.ZM4540@ocotillo.lan> <3929EBCF.2178@cygnus.com>
X-SW-Source: 2000-05/msg00340.html
Content-length: 1022
Date: Mon, 22 May 2000 19:24:15 -0700
From: Michael Snyder <msnyder@cygnus.com>
Well... you're right that their being in sparc-tdep.c is questionable,
but I'm not sure they fit any better in sparc-nat.c, unles that file
is renamed to sparc-solaris-nat.c. These functions are specific to
/proc, which is (one reason) why they would not build on Linux.
Well, /proc may indeed be their origin, but some ELF systems that
don't have the SVR4 /proc provide some of the infrastructure that
makes supply_gregset() and fill_gregset() usefull too. Take for
example Linux/i386 and my upcoming FreeBSD/i386. Now if the gregset_t
and fpregset_t on Linux/Sparc don't differ too much from Solaris, it
may be beneficial too let them share the code.
If (indeed) sparc-nat.c is peculiar to Solaris, then we could move
all of the #if (USE_PROC_FS) code from sparc-tdep.c to there.
Whell, USE_PROC_FS is certainly something that's only relevant for the
host, so it shouldn't be used in sparc-tdep.c :-).
Mark
From eliz@delorie.com Tue May 23 02:28:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: 3diff@paschal.gnu.ai.mit.edu
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: bug report
Date: Tue, 23 May 2000 02:28:00 -0000
Message-id: <200005230928.FAA28576@indy.delorie.com>
References: <200005230018.UAA29653@paschal.gnu.ai.mit.edu>
X-SW-Source: 2000-05/msg00341.html
Content-length: 561
> Date: Mon, 22 May 2000 20:18:15 -0400
> From: Brian Youmans <3diff@paschal.gnu.ai.mit.edu>
>
> Karl Berry will be submitting a diff after cleaning up
> some Texinfo problems. The big one is eliminating
> the duplicate @syncodeindex statements at the beginning
> of gdb.texinfo. Those were preventing the index from printing.
Sorry, I don't follow: what duplicate @syncodeindex statements? I
thought I've eliminated all of them.
FWIW, I did typeset gdb.texinfo and looked at the index with a
previewer. I didn't see any anomalies. Did I miss something?
From kettenis@wins.uva.nl Tue May 23 03:30:00 2000
From: Mark Kettenis <kettenis@wins.uva.nl>
To: jakub@redhat.com
Cc: msnyder@cygnus.com, jimb@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Sparc Linux stuff
Date: Tue, 23 May 2000 03:30:00 -0000
Message-id: <200005231030.e4NAUhr00156@delius.kettenis.local>
References: <20000523091140.C474@sunsite.ms.mff.cuni.cz>
X-SW-Source: 2000-05/msg00342.html
Content-length: 1433
Date: Tue, 23 May 2000 09:11:40 +0200
From: Jakub Jelinek <jakub@redhat.com>
Hi Jakub,
Following patch makes gdb 5.0 compile on sparc-*-linux and adds a
semi-usable support for sparc64-*-linux.
I'll leave reviewing the patch up to those who're really in charge,
but IMHO the patch will need some more work. You're trying to address
multiple, not entirely related issue's at once. Better to split these
out. Furthermore the GDB_TARGET_IS_SPARC_BI_ARCH approach doesn't
seem to be "the right thing" to me. It is probably better to
mult-arch Linux/Sparc. Michael already did some (preliminary)
multi-arch work on Sparc.
This patch works just fine against gdb from say November, but after
somewhen in December things broke - that's why I haven't submitted
the patch yet (no matter whether this patch is in or not (in the
latter case one has to tweak a few things to make things compile),
e.g. next command does not work. Say
#include <stdio.h>
void foo(void)
{
printf("a\n");
}
void bar(void)
{
printf("b\n");
}
void main(void)
{
foo();
bar();
foo();
}
compiled with -g -O0, putting breakpoint on main works just fine
but then if I enter next, it goes on until program exit (ie. does
not stop where it should).
This may very well be caused by GCC not putting out the right
debugging information. What version of GCC are you using?
Mark
From ac131313@cygnus.com Tue May 23 03:47:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Mark Kettenis <kettenis@wins.uva.nl>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: -W* rules for engagement?
Date: Tue, 23 May 2000 03:47:00 -0000
Message-id: <392A6171.64FA2082@cygnus.com>
References: <3923B19F.29591370@cygnus.com> <200005181027.MAA15469@landau.wins.uva.nl>
X-SW-Source: 2000-05/msg00343.html
Content-length: 1419
Mark Kettenis wrote:
> Hmm, how important is -Wpointer-arith? It generates a lot of warnings
> from code in <string.h> on Linux and the Hurd, due to a bug in gcc
> 2.95. For now I've just disabled it in my local CVS tree.
I don't see that here :-( It was added because, at the time, I found it
very easy to get past GCC.
> with a few additional key warnings such as -Wuninitialized
> -Wmissing-prototypes (any others?) and then try to get these down to
> zero so that -Werror can be used on this contracted list. Beyond that,
> people, can pursue things at their leisure.
>
> How to approach this? I'm easy. I am wary of fix warning a-thons and
> the like. Often fixing a warning involves a careful re-examination of
> the code. If someone wants to take it on, I'm again easy.
>
> Enabling additional warnings one by one, giving people a few weeks to
> recover and fix things, is probably the best idea. The majority of
> those won't really involve a lot of re-examination of code. And the
> cases where it does, that code will probably benefit from a
> re-examination, at least if people will review, update and add
> comments to that code.
I'm going to add -Wuninitialized next (I just tripped up on a bug it
would have caught :-( :-).
-Wmissing-prototypes is interesting - people are so good at adding ISO-C
prototypes from -Wimplicit that it can almost be avoided! :-)
Andrew
From ac131313@cygnus.com Tue May 23 04:31:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: -Wuninitialized added
Date: Tue, 23 May 2000 04:31:00 -0000
Message-id: <392A6BC8.2E0CFBD4@cygnus.com>
X-SW-Source: 2000-05/msg00344.html
Content-length: 1320
FYI,
Andrew
Tue May 23 20:47:50 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (build_warnings): Add -Wuninitialized.
* configure: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.24
retrieving revision 1.25
diff -p -r1.24 -r1.25
*** configure.in 2000/05/23 07:49:05 1.24
--- configure.in 2000/05/23 11:28:14 1.25
*************** fi
*** 485,491 ****
# Don't add -Wall or -Wunused, they include -Wunused-parameter which
# causes noise.
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
! -Wformat -Wparentheses -Wpointer-arith"
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
# -Wchar-subscripts -Wuninitialized -Wtraditional -Wshadow -Wcast-qual
--- 485,491 ----
# Don't add -Wall or -Wunused, they include -Wunused-parameter which
# causes noise.
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
! -Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
# -Wchar-subscripts -Wuninitialized -Wtraditional -Wshadow -Wcast-qual
From ac131313@cygnus.com Tue May 23 04:33:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: [patch/sim/common] Fix uninitialized sigrc variable
Date: Tue, 23 May 2000 04:33:00 -0000
Message-id: <392A6C72.B281F44A@cygnus.com>
X-SW-Source: 2000-05/msg00345.html
Content-length: 871
Just FYI,
Andrew
Tue May 23 20:30:12 2000 Andrew Cagney <cagney@amy.cygnus.com>
* run.c (main): Initialize sigrc.
Index: run.c
===================================================================
RCS file: /cvs/src/src/sim/common/run.c,v
retrieving revision 1.4
diff -p -r1.4 run.c
*** run.c 2000/02/22 08:52:20 1.4
--- run.c 2000/05/23 11:31:53
*************** main (ac, av)
*** 242,247 ****
--- 242,248 ----
sim_stop_reason() can be used to determine any stop reason. */
if (trace)
sim_set_trace ();
+ sigrc = 0;
do
{
prev_sigint = signal (SIGINT, cntrl_c);
*************** main (ac, av)
*** 265,270 ****
--- 266,272 ----
else
{
prev_sigint = signal (SIGINT, cntrl_c);
+ sigrc = 0;
sim_resume (sd, 0, sigrc);
signal (SIGINT, prev_sigint);
sim_stop_reason (sd, &reason, &sigrc);
From Gregory.Lielens@fft.be Tue May 23 04:39:00 2000
From: Gregory Lielens <Gregory.Lielens@fft.be>
To: gdb-patches@sourceware.cygnus.com
Subject: Correction of complex number display for fortran program
Date: Tue, 23 May 2000 04:39:00 -0000
Message-id: <392A6E83.85406241@fft.be>
X-SW-Source: 2000-05/msg00346.html
Content-length: 1429
Hi,
I 've just dowloaded GDB 5.0 and use it to debug a fortran subroutine.
I've noted that value of complex variables or arrays are incorrectly
outputed by the print command, and also within the DDD frontend.
When inspecting a complex variable V, the value printed is
(Real(V),Real(V)) instead of (Real(V),Imag(V)). This behavior was
already present in the previous version of gdb, but this time I think
I've corrected it and send you the (very) small patch - one line to
change!
I'll try to follow the guidelines for this, but it's the first time I
contribute and English is not my native language, so don't expect too
much...
Here is the Changelog
Tue May 23 13:20:00 1999 Gregory Lielens <info@fft.be>
* f-valprint.c : Corrected f_val_print function for TYPE_CODE
(type) = TYPE_CODE_COMPLEX
and the diff
diff -up f-valprint.c.old f-valprint.c
--- f-valprint.c.old Tue May 23 13:34:51 2000
+++ f-valprint.c Tue May 23 13:34:25 2000
@@ -564,7 +564,7 @@ f_val_print (type, valaddr, embedded_off
fputs_filtered ("(", stream);
print_floating (valaddr, type, stream);
fputs_filtered (",", stream);
- print_floating (valaddr, type, stream);
+ print_floating (valaddr+TYPE_LENGTH(type), type, stream);
fputs_filtered (")", stream);
break;
Hope this help, and congratulation for the 5.0 release: it seems at lot
more stable when interacting whith DDD
Greg.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-05-22 19:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <oraehlelgf.fsf@tamanduatei.dcc.unicamp.br>
2000-05-20 2:49 ` GDB 5.0 won't build on GNU/Linux/sparc Alexandre Oliva
[not found] ` <392730E1.22BE968B@cygnus.com>
2000-05-21 9:25 ` Michael Snyder
2000-05-22 13:36 ` Alexandre Oliva
2000-05-20 10:08 ` Michael Snyder
2000-05-22 19:12 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox