* gdb 6.6 sim/erc32 does not parse -E option
@ 2007-02-22 17:02 Joel Sherrill
2007-02-22 17:12 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Joel Sherrill @ 2007-02-22 17:02 UTC (permalink / raw)
To: gdb-patches, Ralf Corsepius
[-- Attachment #1: Type: text/plain, Size: 506 bytes --]
Hi,
Apparently gdb 6.6 passes a -E endian option
to the sim_open hook. The erc32 simulator
does not parse this option and produces
a error message like this:
(gdb) tar sim
unknown option -E
open of big failed
Connected to the simulator.
The attached patch is in the style of the
existing code and silently eats the -E option
if the endian value is big or little.
2007-02-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* interf.c: Add parsing of -E <endian> option
to eliminate error message.
[-- Attachment #2: sis.diff --]
[-- Type: text/x-patch, Size: 712 bytes --]
--- gdb-6.6-orig/sim/erc32/interf.c 2005-11-28 12:33:03.000000000 -0600
+++ gdb-6.6/sim/erc32/interf.c 2007-02-22 10:56:55.000000000 -0600
@@ -236,6 +236,18 @@
if ((stat + 1) < argc) {
freq = VAL(argv[++stat]);
}
+ } else
+ if (strcmp(argv[stat], "-E") == 0) {
+ const char *endian = argv[++stat];
+ if ((strcmp(endian, "big") == 0) ||
+ (strcmp(endian, "little") == 0)) {
+ ; /* not supported but correctly supplied, be silent */
+ } else {
+ (*sim_callback->printf_filtered) (
+ sim_callback,
+ "Invalid <endian> option for -E (%s)\n",
+ endian);
+ }
} else {
(*sim_callback->printf_filtered) (sim_callback,
"unknown option %s\n",
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 17:02 gdb 6.6 sim/erc32 does not parse -E option Joel Sherrill
@ 2007-02-22 17:12 ` Daniel Jacobowitz
2007-02-22 17:28 ` Joel Sherrill
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-02-22 17:12 UTC (permalink / raw)
To: Joel Sherrill; +Cc: gdb-patches, Ralf Corsepius
On Thu, Feb 22, 2007 at 11:02:38AM -0600, Joel Sherrill wrote:
> Hi,
>
> Apparently gdb 6.6 passes a -E endian option
> to the sim_open hook. The erc32 simulator
> does not parse this option and produces
> a error message like this:
>
> (gdb) tar sim
> unknown option -E
> open of big failed
> Connected to the simulator.
>
> The attached patch is in the style of the
> existing code and silently eats the -E option
> if the endian value is big or little.
Could you try this instead?
http://sourceware.org/ml/gdb-patches/2007-02/msg00078.html
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 17:12 ` Daniel Jacobowitz
@ 2007-02-22 17:28 ` Joel Sherrill
2007-02-22 18:16 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Joel Sherrill @ 2007-02-22 17:28 UTC (permalink / raw)
To: drow, gdb-patches, Ralf Corsepius
Daniel Jacobowitz wrote:
> On Thu, Feb 22, 2007 at 11:02:38AM -0600, Joel Sherrill wrote:
>
>> Hi,
>>
>> Apparently gdb 6.6 passes a -E endian option
>> to the sim_open hook. The erc32 simulator
>> does not parse this option and produces
>> a error message like this:
>>
>> (gdb) tar sim
>> unknown option -E
>> open of big failed
>> Connected to the simulator.
>>
>> The attached patch is in the style of the
>> existing code and silently eats the -E option
>> if the endian value is big or little.
>>
>
> Could you try this instead?
>
> http://sourceware.org/ml/gdb-patches/2007-02/msg00078.html
>
>
With this patch, gdb still passes a -E big to sim_open in the erc32
simulator code and there is nothing to parse it at that level.
AFAIK the erc32 simulator is big endian only and should just eat
the option for at least endian == big. My patch just ate the option
if it was either big or little and gave an error on any other value.
--joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 17:28 ` Joel Sherrill
@ 2007-02-22 18:16 ` Daniel Jacobowitz
2007-02-22 18:26 ` Joel Sherrill
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-02-22 18:16 UTC (permalink / raw)
To: Joel Sherrill; +Cc: gdb-patches, Ralf Corsepius
On Thu, Feb 22, 2007 at 11:28:38AM -0600, Joel Sherrill wrote:
> With this patch, gdb still passes a -E big to sim_open in the erc32
> simulator code and there is nothing to parse it at that level.
It shouldn't do that. If it does, please show me a complete GDB
session.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 18:16 ` Daniel Jacobowitz
@ 2007-02-22 18:26 ` Joel Sherrill
2007-02-22 18:32 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Joel Sherrill @ 2007-02-22 18:26 UTC (permalink / raw)
To: gdb-patches, Ralf Corsepius
Daniel Jacobowitz wrote:
> On Thu, Feb 22, 2007 at 11:28:38AM -0600, Joel Sherrill wrote:
>
>> With this patch, gdb still passes a -E big to sim_open in the erc32
>> simulator code and there is nothing to parse it at that level.
>>
>
> It shouldn't do that. If it does, please show me a complete GDB
> session.
>
>
I double checked that the patch is applied and
had made clean before the last email. Here is
the user's view:
$ ./gdb/gdb
GNU gdb 6.6
Copyright (C) 2006 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=sparc-rtems4.8".
(gdb) tar sim
unknown option -E
open of big failed
Connected to the simulator.
(gdb)
Here is a gdb of sparc-rtems-gdb:
....................................
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=sparc-rtems4.8".
(gdb) tar sim
Breakpoint 1, sim_open (kind=SIM_OPEN_DEBUG, callback=0x828a6e0, abfd=0x0,
argv=0x885eb58) at ../../../gdb-6.6/sim/erc32/interf.c:191
191 sim_callback = callback;
(gdb) p argv[0]
$1 = 0x885ea58 "gdbsim"
(gdb) p argv[1]
$2 = 0x885ea68 "-E"
(gdb) p argv[2]
$3 = 0x885ea78 "big"
(gdb) p argv[3]
$4 = 0x0
(gdb)
I am not seeing much difference. When I break in
remote-sim.c and step, this is what I see:
Breakpoint 1, gdbsim_open (args=Variable "args" is not available.
) at ../../gdb-6.6/gdb/remote-sim.c:506
506 strcpy (arg_buf, "gdbsim"); /* 7 */
(gdb) n
509 switch (selected_byte_order ())
(gdb)
512 strcat (arg_buf, " -E big");
(gdb)
522 if (selected_architecture_name () != NULL)
(gdb)
528 if (args)
(gdb) n
533 argv = buildargv (arg_buf);
(gdb)
Hopefully this helps.
--joel
--joel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 18:26 ` Joel Sherrill
@ 2007-02-22 18:32 ` Daniel Jacobowitz
2007-02-22 18:46 ` Joel Sherrill
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-02-22 18:32 UTC (permalink / raw)
To: Joel Sherrill; +Cc: gdb-patches, Ralf Corsepius
On Thu, Feb 22, 2007 at 12:26:25PM -0600, Joel Sherrill wrote:
> Daniel Jacobowitz wrote:
> >On Thu, Feb 22, 2007 at 11:28:38AM -0600, Joel Sherrill wrote:
> >
> >>With this patch, gdb still passes a -E big to sim_open in the erc32
> >>simulator code and there is nothing to parse it at that level.
> >>
> >
> >It shouldn't do that. If it does, please show me a complete GDB
> >session.
> >
> >
> I double checked that the patch is applied and
> had made clean before the last email. Here is
> the user's view:
Oh sorry for making you run around in circles. I knew I needed to fix
something, that's why I hadn't applied it yet. It was pointed out
that it needs:
- if (target_byte_order_user)
+ if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
That ought to help!
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 18:32 ` Daniel Jacobowitz
@ 2007-02-22 18:46 ` Joel Sherrill
2007-02-22 18:49 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Joel Sherrill @ 2007-02-22 18:46 UTC (permalink / raw)
To: gdb-patches, Ralf Corsepius
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
Daniel Jacobowitz wrote:
> On Thu, Feb 22, 2007 at 12:26:25PM -0600, Joel Sherrill wrote:
>
>> Daniel Jacobowitz wrote:
>>
>>> On Thu, Feb 22, 2007 at 11:28:38AM -0600, Joel Sherrill wrote:
>>>
>>>
>>>> With this patch, gdb still passes a -E big to sim_open in the erc32
>>>> simulator code and there is nothing to parse it at that level.
>>>>
>>>>
>>> It shouldn't do that. If it does, please show me a complete GDB
>>> session.
>>>
>>>
>>>
>> I double checked that the patch is applied and
>> had made clean before the last email. Here is
>> the user's view:
>>
>
> Oh sorry for making you run around in circles. I knew I needed to fix
> something, that's why I hadn't applied it yet. It was pointed out
> that it needs:
>
> - if (target_byte_order_user)
> + if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
>
> That ought to help!
>
I assumed this went in arch-utils.c and resulted in the attached updated
version of your patch.
It does seem to work now.
If you are happy with the attached patch, then we will make it part of
the RTEMS gdb 6.6 patch.
Thanks.
--joel
>
>
>
[-- Attachment #2: new.diff --]
[-- Type: text/x-patch, Size: 1875 bytes --]
diff -ur gdb-6.6-orig/gdb/arch-utils.c gdb-6.6/gdb/arch-utils.c
--- gdb-6.6-orig/gdb/arch-utils.c 2006-11-10 13:20:35.000000000 -0600
+++ gdb-6.6/gdb/arch-utils.c 2007-02-22 12:43:03.000000000 -0600
@@ -349,6 +349,15 @@
};
static const char *set_endian_string;
+enum bfd_endian
+selected_byte_order (void)
+{
+ if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
+ return TARGET_BYTE_ORDER;
+ else
+ return BFD_ENDIAN_UNKNOWN;
+}
+
/* Called by ``show endian''. */
static void
Only in gdb-6.6/gdb: arch-utils.c.orig
diff -ur gdb-6.6-orig/gdb/arch-utils.h gdb-6.6/gdb/arch-utils.h
--- gdb-6.6-orig/gdb/arch-utils.h 2006-11-10 13:20:35.000000000 -0600
+++ gdb-6.6/gdb/arch-utils.h 2007-02-22 11:23:31.000000000 -0600
@@ -126,6 +126,10 @@
extern int legacy_register_sim_regno (int regnum);
+/* Return the selected byte order, or BFD_ENDIAN_UNKNOWN if no byte
+ order was explicitly selected. */
+extern enum bfd_endian selected_byte_order (void);
+
/* Return the selected architecture's name, or NULL if no architecture
was explicitly selected. */
extern const char *selected_architecture_name (void);
Only in gdb-6.6/gdb: arch-utils.h.orig
diff -ur gdb-6.6-orig/gdb/remote-sim.c gdb-6.6/gdb/remote-sim.c
--- gdb-6.6-orig/gdb/remote-sim.c 2006-11-10 13:20:36.000000000 -0600
+++ gdb-6.6/gdb/remote-sim.c 2007-02-22 11:23:31.000000000 -0600
@@ -504,9 +504,9 @@
+ 50) /* slack */ ;
arg_buf = (char *) alloca (len);
strcpy (arg_buf, "gdbsim"); /* 7 */
- /* Specify the byte order for the target when it is both selectable
- and explicitly specified by the user (not auto detected). */
- switch (TARGET_BYTE_ORDER)
+ /* Specify the byte order for the target when it is explicitly
+ specified by the user (not auto detected). */
+ switch (selected_byte_order ())
{
case BFD_ENDIAN_BIG:
strcat (arg_buf, " -E big");
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: gdb 6.6 sim/erc32 does not parse -E option
2007-02-22 18:46 ` Joel Sherrill
@ 2007-02-22 18:49 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-02-22 18:49 UTC (permalink / raw)
To: Joel Sherrill; +Cc: gdb-patches, Ralf Corsepius
On Thu, Feb 22, 2007 at 12:45:50PM -0600, Joel Sherrill wrote:
> It does seem to work now.
>
> If you are happy with the attached patch, then we will make it part of
> the RTEMS gdb 6.6 patch.
Thanks for testing. I'll really try to get it checked in this week.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-02-22 18:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-22 17:02 gdb 6.6 sim/erc32 does not parse -E option Joel Sherrill
2007-02-22 17:12 ` Daniel Jacobowitz
2007-02-22 17:28 ` Joel Sherrill
2007-02-22 18:16 ` Daniel Jacobowitz
2007-02-22 18:26 ` Joel Sherrill
2007-02-22 18:32 ` Daniel Jacobowitz
2007-02-22 18:46 ` Joel Sherrill
2007-02-22 18:49 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox