This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] sim/ppc/psim.c: ignore architecture param


With the PPC simulator, if you do the following, you get an error, and
the session is aborted:

(gdb) set architecture             
Requires an argument. Valid arguments are rs6000:6000, rs6000:rs1, rs6000:rsc, rs6000:rs2, powerpc:common, auto.
(gdb) set architecture powerpc:common
The target architecture is assumed to be powerpc:common
(gdb) tar sim
Usage:
[usage message...]

With the proposed patch, instead you would get this behavior:

[ezannoni@localhost gdb]$ ./gdb -nw
GNU gdb 2002-06-17-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=powerpc-eabi".
Setting up the environment for debugging gdb.
.gdbinit:5: Error in sourced command file:
No symbol table is loaded.  Use the "file" command.
(gdb) set architecture powerpc:7400
The target architecture is assumed to be powerpc:7400
(gdb) tar sim
Warning - architecture parameter ignored
Connected to the simulator.
(gdb) q



When gdb sees that the architecture has been set manually, it passes the
name of the architecture to the simulator as a parameter:
--architecture=powerpc:7400 (for instance). Psim doesn't digest this one.

All I did was tolerate the option, ignoring it, and continue the
connection.

Elena


2002-06-17  Elena Zannoni  <ezannoni@redhat.com>

        * psim.c (psim_options): Don't choke when gdb invokes us with
        the --architecture option, just ignore it.



Index: psim.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/psim.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 psim.c
--- psim.c	26 Apr 1999 18:33:32 -0000	1.1.1.2
+++ psim.c	17 Jun 2002 18:55:35 -0000
@@ -341,6 +341,19 @@ psim_options(device *root,
 	else
 	  tree_parse(root, "/openprom/trace/%s 1", param);
 	break;
+      case '-':
+	/* it's a long option of the form --optionname=optionvalue.
+	   Such options can be passed through if we are invoked by
+	   gdb.  */
+	if (strstr(argv[argp], "architecture") != NULL) {
+          /* we must consume the argument here, so that we get out
+             of the loop.  */
+	  p = argv[argp] + strlen(argv[argp]) - 1;
+	  printf_filtered("Warning - architecture parameter ignored\n");
+        }
+	else
+	  error("Unrecognized option");
+	break;
       }
       p += 1;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]