This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa] Add -m; Was: ARM sim patch: increase default target memory
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: nickc at redhat dot com
- Cc: Anthony Green <green at redhat dot com>, gdb-patches at sources dot redhat dot com
- Date: Sun, 07 Apr 2002 13:06:10 -0400
- Subject: [rfa] Add -m; Was: ARM sim patch: increase default target memory
- References: <200203171650.g2HGo8714138@louie.sfbay.redhat.com>
Hello,
The attatched patch (er, hack), adds support for the -m flag from the
GDB command line (vis (gdb) target sim -m<size>). It also sets the
default memory size back to something consistent with the other simulators.
ok?
Andrew
2002-04-07 Andrew Cagney <ac131313@redhat.com>
* wrapper.c (sim_open): Add support for -m<mem-size>.
(mem_size): Reduce to 2MB.
Fix PR gdb/433.
Index: wrapper.c
===================================================================
RCS file: /cvs/src/src/sim/arm/wrapper.c,v
retrieving revision 1.18
diff -u -r1.18 wrapper.c
--- wrapper.c 18 Mar 2002 21:43:15 -0000 1.18
+++ wrapper.c 7 Apr 2002 16:59:18 -0000
@@ -47,7 +47,7 @@
static char *myname;
/* Memory size in bytes. */
-static int mem_size = (1 << 23);
+static int mem_size = (1 << 21);
/* Non-zero to display start up banner, and maybe other things. */
static int verbosity;
@@ -448,7 +448,7 @@
{
int i;
- /* Scan for endian-ness switch. */
+ /* Scan for endian-ness and memory-size switches. */
for (i = 0; (argv[i] != NULL) && (argv[i][0] != 0); i++)
if (argv[i][0] == '-' && argv[i][1] == 'E')
{
@@ -482,6 +482,23 @@
(sim_callback, "Unrecognised argument to -E option\n");
break;
}
+ }
+ else if (argv[i][0] == '-' && argv[i][1] == 'm')
+ {
+ if (argv[i][2] != '\0')
+ sim_size (atoi (&argv[i][2]));
+ else if (argv[i + 1] != NULL)
+ {
+ sim_size (atoi (argv[i + 1]));
+ i++;
+ }
+ else
+ {
+ sim_callback->printf_filtered (sim_callback,
+ "Missing argument to -m option\n");
+ return NULL;
+ }
+
}
}