[patch] Re: Can't set architecture to m32c on m32c-elf-gdb.

Masaki Muranaka monaka@monami-software.com
Wed Jan 6 08:18:00 GMT 2010


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
>> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m32c-set-architecture-fix.patch
Type: application/octet-stream
Size: 1453 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100106/b39a412d/attachment.obj>


More information about the Gdb-patches mailing list