* Can't set architecture to m32c on m32c-elf-gdb. @ 2008-12-03 9:17 Masaki Muranaka 2008-12-03 14:08 ` Daniel Jacobowitz 0 siblings, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2008-12-03 9:17 UTC (permalink / raw) To: gdb-patches, binutils Hello, I couldn't set architecture m16c to m32c on the HEAD revision of gdb, I think it is caused by definition in bfd/cpu-m32c.c but I'm not certain. Any comments appreciated. Thanks. Index: cpu-m32c.c =================================================================== RCS file: /cvs/src/src/bfd/cpu-m32c.c,v retrieving revision 1.3 diff -u -p -r1.3 cpu-m32c.c --- cpu-m32c.c 3 Jul 2007 14:26:40 -0000 1.3 +++ cpu-m32c.c 3 Dec 2008 09:07:51 -0000 @@ -47,7 +47,7 @@ const bfd_arch_info_type bfd_m32c_arch = 8, /* Bits per byte. */ bfd_arch_m32c, /* Architecture. */ bfd_mach_m16c, /* Machine. */ - "m32c", /* Architecture name. */ + "m16c", /* Architecture name. */ "m16c", /* Printable name. */ 4, /* Section align power. */ TRUE, /* The default ? */ -- Masaki Muranaka Monami Software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-03 9:17 Can't set architecture to m32c on m32c-elf-gdb Masaki Muranaka @ 2008-12-03 14:08 ` Daniel Jacobowitz 2008-12-04 1:04 ` Masaki Muranaka 2009-12-28 2:32 ` Masaki Muranaka 0 siblings, 2 replies; 22+ messages in thread From: Daniel Jacobowitz @ 2008-12-03 14:08 UTC (permalink / raw) To: Masaki Muranaka; +Cc: gdb-patches, binutils On Wed, Dec 03, 2008 at 06:16:29PM +0900, Masaki Muranaka wrote: > Hello, > > I couldn't set architecture m16c to m32c on the HEAD revision of gdb, > I think it is caused by definition in bfd/cpu-m32c.c but I'm not certain. > Any comments appreciated. Maybe it's supposed to be "set architecture m32c:m16c" ? -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-03 14:08 ` Daniel Jacobowitz @ 2008-12-04 1:04 ` Masaki Muranaka 2008-12-04 4:27 ` Daniel Jacobowitz 2009-12-28 2:32 ` Masaki Muranaka 1 sibling, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2008-12-04 1:04 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches, binutils Hello, Thanks for your suggestion. On 2008/12/03, at 23:08, Daniel Jacobowitz wrote: > Maybe it's supposed to be "set architecture m32c:m16c" ? No. What I want to is just enable m32c register set when I put "set architecture m32c". Additional information about this issue is follows: Before applied my patch. | (gdb) set architecture m32c | The target architecture is assumed to be m16c The architecture settings is not changed. And there seems to be no change around register settings. | (gdb) print $dma0 | $1 = void It's an unsuitable behaviour, right? After applied my patch. | (gdb) set architecture m32c | The target architecture is assumed to be m32c And we can use some extra registers for m32c. > On Wed, Dec 03, 2008 at 06:16:29PM +0900, Masaki Muranaka wrote: >> Hello, >> >> I couldn't set architecture m16c to m32c on the HEAD revision of gdb, >> I think it is caused by definition in bfd/cpu-m32c.c but I'm not certain. >> Any comments appreciated. > > > -- > Daniel Jacobowitz > CodeSourcery > Masaki Muranaka Monami Software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-04 1:04 ` Masaki Muranaka @ 2008-12-04 4:27 ` Daniel Jacobowitz 2008-12-04 6:48 ` Masaki Muranaka 0 siblings, 1 reply; 22+ messages in thread From: Daniel Jacobowitz @ 2008-12-04 4:27 UTC (permalink / raw) To: Masaki Muranaka; +Cc: gdb-patches, binutils On Thu, Dec 04, 2008 at 10:03:56AM +0900, Masaki Muranaka wrote: > Before applied my patch. > > | (gdb) set architecture m32c > | The target architecture is assumed to be m16c > > The architecture settings is not changed. > And there seems to be no change around register settings. > > | (gdb) print $dma0 > | $1 = void > > It's an unsuitable behaviour, right? > > > > After applied my patch. > > | (gdb) set architecture m32c > | The target architecture is assumed to be m32c > > And we can use some extra registers for m32c. ARM has architecture name "arm" and printable name "armv2", and that works fine: (gdb) set architecture arm The target architecture is assumed to be arm (gdb) set architecture armv2 The target architecture is assumed to be armv2 (gdb) set architecture arm The target architecture is assumed to be arm See bfd_default_scan for more. I guess it's because the architecture is named "m32c", but the default flag is set for m16c. If that's so, "set architecture m32c:m32c" should work - does it? In that case your patch makes sense though I don't know what might break. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-04 4:27 ` Daniel Jacobowitz @ 2008-12-04 6:48 ` Masaki Muranaka 2008-12-04 13:13 ` Daniel Jacobowitz 0 siblings, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2008-12-04 6:48 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches, binutils Hello, On 2008/12/04, at 13:26, Daniel Jacobowitz wrote: > ARM has architecture name "arm" and printable name "armv2", and that > works fine: > > (gdb) set architecture arm > The target architecture is assumed to be arm > (gdb) set architecture armv2 > The target architecture is assumed to be armv2 > (gdb) set architecture arm > The target architecture is assumed to be arm Ok. I'll read the code for ARM later. > See bfd_default_scan for more. I guess it's because the architecture > is named "m32c", but the default flag is set for m16c. If that's so, > "set architecture m32c:m32c" should work - does it? | For bug reporting instructions, please see: | <http://www.gnu.org/software/gdb/bugs/>. | (gdb) set architecture m32c:m32c | Undefined item: "m32c:m32c". | (gdb) set architecture m32c:m16c | Undefined item: "m32c:m16c". Should I put any commands before 'set architecture'? -- Masaki Muranaka Monami Software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-04 6:48 ` Masaki Muranaka @ 2008-12-04 13:13 ` Daniel Jacobowitz 2008-12-04 14:22 ` Pedro Alves 0 siblings, 1 reply; 22+ messages in thread From: Daniel Jacobowitz @ 2008-12-04 13:13 UTC (permalink / raw) To: Masaki Muranaka; +Cc: gdb-patches, binutils On Thu, Dec 04, 2008 at 03:47:05PM +0900, Masaki Muranaka wrote: > > See bfd_default_scan for more. I guess it's because the architecture > > is named "m32c", but the default flag is set for m16c. If that's so, > > "set architecture m32c:m32c" should work - does it? > > | For bug reporting instructions, please see: > | <http://www.gnu.org/software/gdb/bugs/>. > | (gdb) set architecture m32c:m32c > | Undefined item: "m32c:m32c". > | (gdb) set architecture m32c:m16c > | Undefined item: "m32c:m16c". > > Should I put any commands before 'set architecture'? Strange. I guess I don't understand how this works, then. I thought this would do it: /* Given that printable_name contains no colon, attempt to match: ARCH_NAME [ ":" ] PRINTABLE_NAME? */ -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-04 13:13 ` Daniel Jacobowitz @ 2008-12-04 14:22 ` Pedro Alves 2008-12-05 0:29 ` Masaki Muranaka 0 siblings, 1 reply; 22+ messages in thread From: Pedro Alves @ 2008-12-04 14:22 UTC (permalink / raw) To: gdb-patches; +Cc: Daniel Jacobowitz, Masaki Muranaka, binutils On Thursday 04 December 2008 13:12:24, Daniel Jacobowitz wrote: > On Thu, Dec 04, 2008 at 03:47:05PM +0900, Masaki Muranaka wrote: > > > See bfd_default_scan for more. I guess it's because the architecture > > > is named "m32c", but the default flag is set for m16c. If that's so, > > > "set architecture m32c:m32c" should work - does it? > > > > | For bug reporting instructions, please see: > > | <http://www.gnu.org/software/gdb/bugs/>. > > | (gdb) set architecture m32c:m32c > > | Undefined item: "m32c:m32c". > > | (gdb) set architecture m32c:m16c > > | Undefined item: "m32c:m16c". > > > > Should I put any commands before 'set architecture'? > > Strange. I guess I don't understand how this works, then. I thought > this would do it: > > /* Given that printable_name contains no colon, attempt to match: > ARCH_NAME [ ":" ] PRINTABLE_NAME? */ > The "Undefined item:" error comes from the fact that "set architecture" is an "enum" command, and gdb is complaining that those entries aren't listed as possible enumerations. All settings gdb will accept are shown with 'set architecture <tab><tab>'. What options does that show? -- Pedro Alves ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-04 14:22 ` Pedro Alves @ 2008-12-05 0:29 ` Masaki Muranaka 0 siblings, 0 replies; 22+ messages in thread From: Masaki Muranaka @ 2008-12-05 0:29 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches, Daniel Jacobowitz, binutils Hello, The result of <tab><tab> is : | This GDB was configured as "--host=i386-apple-darwin9.5.0 --target=m32c-elf". | For bug reporting instructions, please see: | <http://www.gnu.org/software/gdb/bugs/>. | (gdb) set architecture | auto m16c m32c On 2008/12/04, at 23:22, Pedro Alves wrote: > On Thursday 04 December 2008 13:12:24, Daniel Jacobowitz wrote: >> On Thu, Dec 04, 2008 at 03:47:05PM +0900, Masaki Muranaka wrote: >>>> See bfd_default_scan for more. I guess it's because the architecture >>>> is named "m32c", but the default flag is set for m16c. If that's so, >>>> "set architecture m32c:m32c" should work - does it? >>> >>> | For bug reporting instructions, please see: >>> | <http://www.gnu.org/software/gdb/bugs/>. >>> | (gdb) set architecture m32c:m32c >>> | Undefined item: "m32c:m32c". >>> | (gdb) set architecture m32c:m16c >>> | Undefined item: "m32c:m16c". >>> >>> Should I put any commands before 'set architecture'? >> >> Strange. I guess I don't understand how this works, then. I thought >> this would do it: >> >> /* Given that printable_name contains no colon, attempt to match: >> ARCH_NAME [ ":" ] PRINTABLE_NAME? */ >> > > The "Undefined item:" error comes from the fact that "set architecture" is > an "enum" command, and gdb is complaining that those entries aren't listed > as possible enumerations. > > All settings gdb will accept are shown with 'set architecture <tab><tab>'. > What options does that show? > > -- > Pedro Alves > Masaki Muranaka Monami Software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2008-12-03 14:08 ` Daniel Jacobowitz 2008-12-04 1:04 ` Masaki Muranaka @ 2009-12-28 2:32 ` Masaki Muranaka 2009-12-31 12:22 ` Nick Clifton 1 sibling, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2009-12-28 2:32 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches, binutils Hello, I figured out the reason about this issue. This is caused by a bug in bfd/cpu-m32c.c. The condision is like this: He expects to select arch_info_struct[0] when he puts "set architecture m32c". But bfd_m32c_arch is selected bfd_default_scan(). So he always gets configuration for m16c instead of m32c. I think printable names in bfd/cpu-m32.c should be changed to "m32c:m16c", "m32c:m32c". On 2008/12/03, at 23:08, Daniel Jacobowitz wrote: > On Wed, Dec 03, 2008 at 06:16:29PM +0900, Masaki Muranaka wrote: >> Hello, >> >> I couldn't set architecture m16c to m32c on the HEAD revision of gdb, >> I think it is caused by definition in bfd/cpu-m32c.c but I'm not certain. >> Any comments appreciated. > > Maybe it's supposed to be "set architecture m32c:m16c" ? > > -- > Daniel Jacobowitz > CodeSourcery > -- Masaki Muranaka Monami software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2009-12-28 2:32 ` Masaki Muranaka @ 2009-12-31 12:22 ` Nick Clifton 2010-01-03 0:00 ` Masaki Muranaka 0 siblings, 1 reply; 22+ messages in thread From: Nick Clifton @ 2009-12-31 12:22 UTC (permalink / raw) To: Masaki Muranaka; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hi Masaki, > I figured out the reason about this issue. > This is caused by a bug in bfd/cpu-m32c.c. > > The condision is like this: > He expects to select arch_info_struct[0] when he puts "set architecture m32c". > But bfd_m32c_arch is selected bfd_default_scan(). So he always gets > configuration for m16c instead of m32c. But as Daniel pointed out, if the user enters the command: set architecture m32c:m32c then the code in bfd_default_scan() will select the m32c architecture and if the user enters: set architecture m32c:m16c then bfd_default_scan() will select the m16c architecture. > I think printable names in bfd/cpu-m32.c should be changed to "m32c:m16c", "m32c:m32c". There is no need for this, and in fact it will stop bfd_default_scan from working as intended. Cheers Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2009-12-31 12:22 ` Nick Clifton @ 2010-01-03 0:00 ` Masaki Muranaka 2010-01-06 8:18 ` [patch] " Masaki Muranaka 2010-01-06 15:17 ` Nick Clifton 0 siblings, 2 replies; 22+ messages in thread From: Masaki Muranaka @ 2010-01-03 0:00 UTC (permalink / raw) To: Nick Clifton; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hello Nick, Really did you try them? Here is a log of my GDB. (gdb) show architecture The target architecture is set automatically (currently m16c) (gdb) set architecture m32c:m32c Undefined item: "m32c:m32c". (gdb) set architecture m32c:m16c Undefined item: "m32c:m16c". I got their sources via official git repository. Thanks, On 2009/12/31, at 21:22, Nick Clifton wrote: > Hi Masaki, > >> I figured out the reason about this issue. >> This is caused by a bug in bfd/cpu-m32c.c. >> The condision is like this: >> He expects to select arch_info_struct[0] when he puts "set architecture m32c". >> But bfd_m32c_arch is selected bfd_default_scan(). So he always gets >> configuration for m16c instead of m32c. > > But as Daniel pointed out, if the user enters the command: > > set architecture m32c:m32c > > then the code in bfd_default_scan() will select the m32c architecture and if the user enters: > > set architecture m32c:m16c > > then bfd_default_scan() will select the m16c architecture. > >> I think printable names in bfd/cpu-m32.c should be changed to "m32c:m16c", "m32c:m32c". > > There is no need for this, and in fact it will stop bfd_default_scan from working as intended. > > Cheers > Nick > ^ permalink raw reply [flat|nested] 22+ messages in thread
* [patch] Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-03 0:00 ` Masaki Muranaka @ 2010-01-06 8:18 ` Masaki Muranaka 2010-01-06 15:17 ` Nick Clifton 1 sibling, 0 replies; 22+ messages in thread From: Masaki Muranaka @ 2010-01-06 8:18 UTC (permalink / raw) To: Masaki Muranaka; +Cc: Nick Clifton, Daniel Jacobowitz, gdb-patches, binutils [-- Attachment #1: Type: text/plain, Size: 2332 bytes --] Hello maintainers, This is another plan to fix the issue. I think it is better than in the past because it is similar to cpu-arm.c. I attach the patch. I made sure If this issue is fixed by my patch. - - - This GDB was configured as "--host=x86_64-apple-darwin10.2.0 --target=m32c-elf". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb) show architecture The target architecture is set automatically (currently m16c) (gdb) print $dma0 $1 = void (gdb) set architecture m32c The target architecture is assumed to be m32c (gdb) print $dma0 No registers. (gdb) set architecture m16c The target architecture is assumed to be m16c (gdb) print $dma0 $2 = void (gdb) - - - ChangeLog: 2010-01-05 Masaki Muranaka <monaka@monami-software.com> * cpu-m32c.c (scan): New function. (arch_info_struct): Use scan() instead of bfd_default_scan(). (bfd_m32c_arch): Ditto. On 2010/01/03, at 9:00, Masaki Muranaka wrote: > Hello Nick, > > Really did you try them? Here is a log of my GDB. > > (gdb) show architecture > The target architecture is set automatically (currently m16c) > (gdb) set architecture m32c:m32c > Undefined item: "m32c:m32c". > (gdb) set architecture m32c:m16c > Undefined item: "m32c:m16c". > > I got their sources via official git repository. > > Thanks, > > On 2009/12/31, at 21:22, Nick Clifton wrote: > >> Hi Masaki, >> >>> I figured out the reason about this issue. >>> This is caused by a bug in bfd/cpu-m32c.c. >>> The condision is like this: >>> He expects to select arch_info_struct[0] when he puts "set architecture m32c". >>> But bfd_m32c_arch is selected bfd_default_scan(). So he always gets >>> configuration for m16c instead of m32c. >> >> But as Daniel pointed out, if the user enters the command: >> >> set architecture m32c:m32c >> >> then the code in bfd_default_scan() will select the m32c architecture and if the user enters: >> >> set architecture m32c:m16c >> >> then bfd_default_scan() will select the m16c architecture. >> >>> I think printable names in bfd/cpu-m32.c should be changed to "m32c:m16c", "m32c:m32c". >> >> There is no need for this, and in fact it will stop bfd_default_scan from working as intended. >> >> Cheers >> Nick >> > > [-- Attachment #2: m32c-set-architecture-fix.patch --] [-- Type: application/octet-stream, Size: 1453 bytes --] diff --git a/bfd/cpu-m32c.c b/bfd/cpu-m32c.c index aa2e28d..dde8c61 100644 --- a/bfd/cpu-m32c.c +++ b/bfd/cpu-m32c.c @@ -1,5 +1,5 @@ /* BFD support for the M16C/M32C processors. - Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -22,6 +22,16 @@ #include "bfd.h" #include "libbfd.h" +static bfd_boolean +scan (const struct bfd_arch_info *info, const char *string) +{ + /* First test for an exact match. */ + if (strcasecmp (string, info->printable_name) == 0) + return TRUE; + + return FALSE; +} + static const bfd_arch_info_type arch_info_struct[] = { { @@ -35,7 +45,7 @@ static const bfd_arch_info_type arch_info_struct[] = 3, /* section align power */ FALSE, /* the default ? */ bfd_default_compatible, /* architecture comparison fn */ - bfd_default_scan, /* string to architecture convert fn */ + scan, /* string to architecture convert fn */ NULL /* next in list */ }, }; @@ -52,6 +62,6 @@ const bfd_arch_info_type bfd_m32c_arch = 4, /* Section align power. */ TRUE, /* The default ? */ bfd_default_compatible, /* Architecture comparison fn. */ - bfd_default_scan, /* String to architecture convert fn. */ + scan, /* String to architecture convert fn. */ &arch_info_struct[0], /* Next in list. */ }; ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-03 0:00 ` Masaki Muranaka 2010-01-06 8:18 ` [patch] " Masaki Muranaka @ 2010-01-06 15:17 ` Nick Clifton 2010-01-06 23:24 ` Masaki Muranaka 1 sibling, 1 reply; 22+ messages in thread From: Nick Clifton @ 2010-01-06 15:17 UTC (permalink / raw) To: Masaki Muranaka; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hi Masaki, > Really did you try them? Here is a log of my GDB. > > (gdb) show architecture > The target architecture is set automatically (currently m16c) > (gdb) set architecture m32c:m32c > Undefined item: "m32c:m32c". > (gdb) set architecture m32c:m16c > Undefined item: "m32c:m16c". Point. But when I try this: (gdb) show architecture The target architecture is set automatically (currently m16c) (gdb) set architecture m32c The target architecture is assumed to be m32c (gdb) show architecture The target architecture is assumed to be m32c (gdb) set architecture m16c The target architecture is assumed to be m16c (gdb) show architecture The target architecture is assumed to be m16c So it appears that you can set the architecture to m32c, yes ? Cheers Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-06 15:17 ` Nick Clifton @ 2010-01-06 23:24 ` Masaki Muranaka 2010-01-07 15:54 ` Nick Clifton 0 siblings, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2010-01-06 23:24 UTC (permalink / raw) To: Nick Clifton; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hello Nick, It might you feel you could set architecture to m32c, BFD (bfd_default_scan) returns arch_info for m16c always. This is the point. Please try 'print $dma0' on GDB (w/o my patch). (gdb) show architecture The target architecture is set automatically (currently m16c) (gdb) set architecture m32c The target architecture is assumed to be m32c (gdb) show architecture The target architecture is assumed to be m32c (gdb) print $dma0 $1 = void dma0 is a register supported by m32c only. So the result of 'print $dma0' is ... In case m32c, it should be 'No registers.' In case m16c, it should be ''void' since it doesn't have dma0 register. Thanks, On 2010/01/07, at 0:17, Nick Clifton wrote: > Hi Masaki, > >> Really did you try them? Here is a log of my GDB. >> (gdb) show architecture >> The target architecture is set automatically (currently m16c) >> (gdb) set architecture m32c:m32c >> Undefined item: "m32c:m32c". >> (gdb) set architecture m32c:m16c >> Undefined item: "m32c:m16c". > > Point. But when I try this: > > (gdb) show architecture > The target architecture is set automatically (currently m16c) > (gdb) set architecture m32c > The target architecture is assumed to be m32c > (gdb) show architecture > The target architecture is assumed to be m32c > (gdb) set architecture m16c > The target architecture is assumed to be m16c > (gdb) show architecture > The target architecture is assumed to be m16c > > So it appears that you can set the architecture to m32c, yes ? > > Cheers > Nick > -- Masaki Muranaka Monami software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-06 23:24 ` Masaki Muranaka @ 2010-01-07 15:54 ` Nick Clifton 2010-01-07 22:38 ` Masaki Muranaka 0 siblings, 1 reply; 22+ messages in thread From: Nick Clifton @ 2010-01-07 15:54 UTC (permalink / raw) To: Masaki Muranaka; +Cc: Daniel Jacobowitz, gdb-patches, binutils [-- Attachment #1: Type: text/plain, Size: 676 bytes --] Hi Masaki, > Please try 'print $dma0' on GDB (w/o my patch). > dma0 is a register supported by m32c only. > So the result of 'print $dma0' is ... > In case m32c, it should be 'No registers.' > In case m16c, it should be ''void' since it doesn't have dma0 register. Thank you - that was the extra information that I needed in order to be able to diagnose this problem. Please try out the attached patch and let me know if it works for you. By the way, this has exposed a problem with GDB's set architecture command - it is not set up to allow the "ARCH:MACH" notation that is accepted by the BFD library. Maybe someone will want to fix this one day... Cheers Nick [-- Attachment #2: cpu-m32c.c.patch --] [-- Type: text/x-diff, Size: 1940 bytes --] Index: bfd/cpu-m32c.c =================================================================== RCS file: /cvs/src/src/bfd/cpu-m32c.c,v retrieving revision 1.4 diff -c -3 -p -r1.4 cpu-m32c.c *** bfd/cpu-m32c.c 2 Sep 2009 07:18:36 -0000 1.4 --- bfd/cpu-m32c.c 7 Jan 2010 15:44:35 -0000 *************** *** 22,27 **** --- 22,40 ---- #include "bfd.h" #include "libbfd.h" + /* Like bfd_default_scan but if the string is just "m32c" then + skip the m16c architecture. */ + + static bfd_boolean + m32c_scan (const bfd_arch_info_type * info, const char * string) + { + if (strcmp (string, "m32c") == 0 + && info->mach == bfd_mach_m16c) + return FALSE; + + return bfd_default_scan (info, string); + } + static const bfd_arch_info_type arch_info_struct[] = { { *************** static const bfd_arch_info_type arch_inf *** 35,41 **** 3, /* section align power */ FALSE, /* the default ? */ bfd_default_compatible, /* architecture comparison fn */ ! bfd_default_scan, /* string to architecture convert fn */ NULL /* next in list */ }, }; --- 48,54 ---- 3, /* section align power */ FALSE, /* the default ? */ bfd_default_compatible, /* architecture comparison fn */ ! m32c_scan, /* string to architecture convert fn */ NULL /* next in list */ }, }; *************** const bfd_arch_info_type bfd_m32c_arch = *** 52,57 **** 4, /* Section align power. */ TRUE, /* The default ? */ bfd_default_compatible, /* Architecture comparison fn. */ ! bfd_default_scan, /* String to architecture convert fn. */ &arch_info_struct[0], /* Next in list. */ }; --- 65,70 ---- 4, /* Section align power. */ TRUE, /* The default ? */ bfd_default_compatible, /* Architecture comparison fn. */ ! m32c_scan, /* String to architecture convert fn. */ &arch_info_struct[0], /* Next in list. */ }; ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-07 15:54 ` Nick Clifton @ 2010-01-07 22:38 ` Masaki Muranaka 2010-01-07 22:45 ` DJ Delorie 2010-01-08 11:40 ` Nick Clifton 0 siblings, 2 replies; 22+ messages in thread From: Masaki Muranaka @ 2010-01-07 22:38 UTC (permalink / raw) To: Nick Clifton; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hello Nick, Though I've not tried your patch yet, it also will works fine. But I feel my patch is better. Renesas is planning to ship R32C series. They have a lot of extensions but basically based on M32C. R32C aims automovice areas, so it's possible they have some custom variations. I think it's better to specify architecture by printable name like cpu-arm.c > By the way, this has exposed a problem with GDB's set architecture command - it is not set up to allow the "ARCH:MACH" notation that is accepted by the BFD library. Maybe someone will want to fix this one day... Indeed, I'm mistaken about that. Thanks, On 2010/01/08, at 0:49, Nick Clifton wrote: > Hi Masaki, > >> Please try 'print $dma0' on GDB (w/o my patch). >> dma0 is a register supported by m32c only. >> So the result of 'print $dma0' is ... >> In case m32c, it should be 'No registers.' >> In case m16c, it should be ''void' since it doesn't have dma0 register. > > Thank you - that was the extra information that I needed in order to be able to diagnose this problem. > > Please try out the attached patch and let me know if it works for you. > > By the way, this has exposed a problem with GDB's set architecture command - it is not set up to allow the "ARCH:MACH" notation that is accepted by the BFD library. Maybe someone will want to fix this one day... > > Cheers > Nick > > Index: bfd/cpu-m32c.c > =================================================================== > RCS file: /cvs/src/src/bfd/cpu-m32c.c,v > retrieving revision 1.4 > diff -c -3 -p -r1.4 cpu-m32c.c > *** bfd/cpu-m32c.c 2 Sep 2009 07:18:36 -0000 1.4 > --- bfd/cpu-m32c.c 7 Jan 2010 15:44:35 -0000 > *************** > *** 22,27 **** > --- 22,40 ---- > #include "bfd.h" > #include "libbfd.h" > > + /* Like bfd_default_scan but if the string is just "m32c" then > + skip the m16c architecture. */ > + > + static bfd_boolean > + m32c_scan (const bfd_arch_info_type * info, const char * string) > + { > + if (strcmp (string, "m32c") == 0 > + && info->mach == bfd_mach_m16c) > + return FALSE; > + > + return bfd_default_scan (info, string); > + } > + > static const bfd_arch_info_type arch_info_struct[] = > { > { > *************** static const bfd_arch_info_type arch_inf > *** 35,41 **** > 3, /* section align power */ > FALSE, /* the default ? */ > bfd_default_compatible, /* architecture comparison fn */ > ! bfd_default_scan, /* string to architecture convert fn */ > NULL /* next in list */ > }, > }; > --- 48,54 ---- > 3, /* section align power */ > FALSE, /* the default ? */ > bfd_default_compatible, /* architecture comparison fn */ > ! m32c_scan, /* string to architecture convert fn */ > NULL /* next in list */ > }, > }; > *************** const bfd_arch_info_type bfd_m32c_arch = > *** 52,57 **** > 4, /* Section align power. */ > TRUE, /* The default ? */ > bfd_default_compatible, /* Architecture comparison fn. */ > ! bfd_default_scan, /* String to architecture convert fn. */ > &arch_info_struct[0], /* Next in list. */ > }; > --- 65,70 ---- > 4, /* Section align power. */ > TRUE, /* The default ? */ > bfd_default_compatible, /* Architecture comparison fn. */ > ! m32c_scan, /* String to architecture convert fn. */ > &arch_info_struct[0], /* Next in list. */ > }; ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-07 22:38 ` Masaki Muranaka @ 2010-01-07 22:45 ` DJ Delorie 2010-01-08 0:02 ` Masaki Muranaka 2010-01-08 11:40 ` Nick Clifton 1 sibling, 1 reply; 22+ messages in thread From: DJ Delorie @ 2010-01-07 22:45 UTC (permalink / raw) To: Masaki Muranaka; +Cc: nickc, drow, gdb-patches, binutils > Renesas is planning to ship R32C series. They're already shipping it. It's as different from M32C as M32C is from M16C (m16c/60 at least) - no opcode compatibility at all, aside from a "passing resemblance" at the asm syntax level. M16C vs R8C is much closer; they differ only in two opcodes. M16C/80 vs M32C/80 have the same architecture, but m32c has more opcodes. RX is a step up from R32C. Same peripherals, basically, but completely different opcodes and register set. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-07 22:45 ` DJ Delorie @ 2010-01-08 0:02 ` Masaki Muranaka 2010-01-08 0:07 ` DJ Delorie 0 siblings, 1 reply; 22+ messages in thread From: Masaki Muranaka @ 2010-01-08 0:02 UTC (permalink / raw) To: DJ Delorie; +Cc: nickc, drow, gdb-patches, binutils Hello DJ, Yes some series cores are already shipped it and some are still planning. I didn't say R32C is same as M32C. But I think their register sets and periherals are quite similar. And Renesas says R32C is the high end model of M16C/M32C series, right? I agree RX is completely different opcode/registers from M16C family. ("RX is a step up from R32C. " is similar to "SH-1/2 is a step up from H8") So I have no view about RX supports on GNU chains. Thanks, On 2010/01/08, at 7:44, DJ Delorie wrote: > >> Renesas is planning to ship R32C series. > > They're already shipping it. It's as different from M32C as M32C is > from M16C (m16c/60 at least) - no opcode compatibility at all, aside > from a "passing resemblance" at the asm syntax level. > > M16C vs R8C is much closer; they differ only in two opcodes. M16C/80 > vs M32C/80 have the same architecture, but m32c has more opcodes. > > RX is a step up from R32C. Same peripherals, basically, but > completely different opcodes and register set. > -- Masaki Muranaka Monami software ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-08 0:02 ` Masaki Muranaka @ 2010-01-08 0:07 ` DJ Delorie 2010-01-08 0:45 ` Masaki Muranaka 0 siblings, 1 reply; 22+ messages in thread From: DJ Delorie @ 2010-01-08 0:07 UTC (permalink / raw) To: Masaki Muranaka; +Cc: nickc, drow, gdb-patches, binutils > Yes some series cores are already shipped it and some are still > planning. I didn't say R32C is same as M32C. But I think their > register sets and periherals are quite similar. And Renesas says > R32C is the high end model of M16C/M32C series, right? Right, but r32c isn't a "type of m32c" - it's a sibling to m32c, much like m32c is a sibling to m16c. The register set is similar, but not quite the same, and the instruction set is similar, but not quite the same, etc. > I agree RX is completely different opcode/registers from M16C > family. ("RX is a step up from R32C. " is similar to "SH-1/2 is a > step up from H8") So I have no view about RX supports on GNU chains. RX shares many peripherals and electrical configurations with m32c/r32c though. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-08 0:07 ` DJ Delorie @ 2010-01-08 0:45 ` Masaki Muranaka 0 siblings, 0 replies; 22+ messages in thread From: Masaki Muranaka @ 2010-01-08 0:45 UTC (permalink / raw) To: DJ Delorie; +Cc: nickc, drow, gdb-patches, binutils Hello DJ, Hmm, it's possible a matter of degree... Talking about that cpu-m32c.c. In case you try to support R32C target, where target_info for R32C should be placed in? There are two strategy. One is to create cpu-r32c.c, The another is to append to cpu-m32c.c I have no objection about Nick's patch in case we will adopt the former. But I think it's better the latter since Renesas regards R32C as M16C family. On 2010/01/08, at 9:07, DJ Delorie wrote: > >> Yes some series cores are already shipped it and some are still >> planning. I didn't say R32C is same as M32C. But I think their >> register sets and periherals are quite similar. And Renesas says >> R32C is the high end model of M16C/M32C series, right? > > Right, but r32c isn't a "type of m32c" - it's a sibling to m32c, much > like m32c is a sibling to m16c. The register set is similar, but not > quite the same, and the instruction set is similar, but not quite the > same, etc. > >> I agree RX is completely different opcode/registers from M16C >> family. ("RX is a step up from R32C. " is similar to "SH-1/2 is a >> step up from H8") So I have no view about RX supports on GNU chains. > > RX shares many peripherals and electrical configurations with > m32c/r32c though. > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-07 22:38 ` Masaki Muranaka 2010-01-07 22:45 ` DJ Delorie @ 2010-01-08 11:40 ` Nick Clifton 2010-01-12 0:04 ` Masaki Muranaka 1 sibling, 1 reply; 22+ messages in thread From: Nick Clifton @ 2010-01-08 11:40 UTC (permalink / raw) To: Masaki Muranaka; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hi Masaki, > Hello Nick, > > Though I've not tried your patch yet, it also will works fine. > > But I feel my patch is better. > Renesas is planning to ship R32C series. They have a lot of extensions but basically based on M32C. > R32C aims automovice areas, so it's possible they have some custom variations. > I think it's better to specify architecture by printable name like cpu-arm.c But that is what my patch does. It fixes the scanning code in the bfd library so that when the user enters: set architecture m32c in gdb it will correctly locate the m32c architecture and not the m16c architecture as it was doing previously. Cheers Nick ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Can't set architecture to m32c on m32c-elf-gdb. 2010-01-08 11:40 ` Nick Clifton @ 2010-01-12 0:04 ` Masaki Muranaka 0 siblings, 0 replies; 22+ messages in thread From: Masaki Muranaka @ 2010-01-12 0:04 UTC (permalink / raw) To: Nick Clifton; +Cc: Daniel Jacobowitz, gdb-patches, binutils Hello Nick, Ok. It might only has to think at that time about R32C. Thanks On 2010/01/08, at 20:40, Nick Clifton wrote: > Hi Masaki, > >> Hello Nick, >> Though I've not tried your patch yet, it also will works fine. >> But I feel my patch is better. >> Renesas is planning to ship R32C series. They have a lot of extensions but basically based on M32C. >> R32C aims automovice areas, so it's possible they have some custom variations. >> I think it's better to specify architecture by printable name like cpu-arm.c > > But that is what my patch does. It fixes the scanning code in the bfd library so that when the user enters: > > set architecture m32c > > in gdb it will correctly locate the m32c architecture and not the m16c architecture as it was doing previously. > > Cheers > Nick > ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2010-01-12 0:04 UTC | newest] Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-12-03 9:17 Can't set architecture to m32c on m32c-elf-gdb Masaki Muranaka 2008-12-03 14:08 ` Daniel Jacobowitz 2008-12-04 1:04 ` Masaki Muranaka 2008-12-04 4:27 ` Daniel Jacobowitz 2008-12-04 6:48 ` Masaki Muranaka 2008-12-04 13:13 ` Daniel Jacobowitz 2008-12-04 14:22 ` Pedro Alves 2008-12-05 0:29 ` Masaki Muranaka 2009-12-28 2:32 ` Masaki Muranaka 2009-12-31 12:22 ` Nick Clifton 2010-01-03 0:00 ` Masaki Muranaka 2010-01-06 8:18 ` [patch] " Masaki Muranaka 2010-01-06 15:17 ` Nick Clifton 2010-01-06 23:24 ` Masaki Muranaka 2010-01-07 15:54 ` Nick Clifton 2010-01-07 22:38 ` Masaki Muranaka 2010-01-07 22:45 ` DJ Delorie 2010-01-08 0:02 ` Masaki Muranaka 2010-01-08 0:07 ` DJ Delorie 2010-01-08 0:45 ` Masaki Muranaka 2010-01-08 11:40 ` Nick Clifton 2010-01-12 0:04 ` Masaki Muranaka
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox