From: Michael Snyder <msnyder@redhat.com>
To: Michael Snyder <msnyder@redhat.com>
Cc: Andrew Cagney <ac131313@redhat.com>,
"Dhananjay R. Deshpande" <dhananjayd@KPITCummins.com>,
gdb-patches@sources.redhat.com
Subject: Re: H8300 Patch - Fix GDB crash problem when object file of different H8 cpu is loaded
Date: Fri, 14 Nov 2003 20:13:00 -0000 [thread overview]
Message-ID: <3FB5377F.8040709@redhat.com> (raw)
In-Reply-To: <3FB5351A.3040009@redhat.com>
Michael Snyder wrote:
> Andrew Cagney wrote:
>> Unfortunatly this isn't the right way to go.
BTW, I'm glad you replied to this -- I was going to just approve it. ;-)
> The only problem is, these functions would be called from the sim.
> Since the sim doesn't know about struct gdbarch, and since you've
> written them as using the global current_gdbarch anyway, they
> probably should have no argument.
On further reflection, Andrew, the sim also needs to be able to
set these variables. In fact, they really belong to the sim,
in as much as that's where they're defined.
>
> Michael
>
>>
>>> Changelog -
>>> 2003-11-14 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
>>> * gdb/h8300-tdep.c (h8300_gdbarch_init): Set globals before
>>> returning existing gdbarch
>>>
>>> =================================================================================
>>>
>>> --- gdb/h8300-tdep.c.old 2003-11-12 13:51:36.000000000 +0530
>>> +++ gdb/h8300-tdep.c 2003-11-14 11:08:29.000000000 +0530
>>> @@ -1176,6 +1176,53 @@ h8300_gdbarch_init (struct gdbarch_info
>>> struct gdbarch_tdep *tdep = NULL;
>>> struct gdbarch *gdbarch;
>>>
>>> + /* Set globals */
>>> + switch (info.bfd_arch_info->mach)
>>> + {
>>> + case bfd_mach_h8300:
>>> + h8300_normal_mode = 0;
>>> + h8300sxmode = 0;
>>> + h8300smode = 0;
>>> + h8300hmode = 0;
>>> + break;
>>> + case bfd_mach_h8300h:
>>> + h8300_normal_mode = 0;
>>> + h8300sxmode = 0;
>>> + h8300smode = 0;
>>> + h8300hmode = 1;
>>> + break;
>>> + case bfd_mach_h8300hn:
>>> + h8300_normal_mode = 1;
>>> + h8300sxmode = 0;
>>> + h8300smode = 0;
>>> + h8300hmode = 1;
>>> + break;
>>> + case bfd_mach_h8300s:
>>> + h8300_normal_mode = 0;
>>> + h8300sxmode = 0;
>>> + h8300smode = 1;
>>> + h8300hmode = 1;
>>> + break;
>>> + case bfd_mach_h8300sn:
>>> + h8300_normal_mode = 1;
>>> + h8300sxmode = 0;
>>> + h8300smode = 1;
>>> + h8300hmode = 1;
>>> + break;
>>> + case bfd_mach_h8300sx:
>>> + h8300_normal_mode = 0;
>>> + h8300sxmode = 1;
>>> + h8300smode = 1;
>>> + h8300hmode = 1;
>>> + break;
>>> + case bfd_mach_h8300sxn:
>>> + h8300_normal_mode = 1;
>>> + h8300sxmode = 1;
>>> + h8300smode = 1;
>>> + h8300hmode = 1;
>>> + break;
>>> + }
>>> +
>>> arches = gdbarch_list_lookup_by_info (arches, &info);
>>> if (arches != NULL)
>>> return arches->gdbarch;
>>> @@ -1192,9 +1239,6 @@ h8300_gdbarch_init (struct gdbarch_info
>>> switch (info.bfd_arch_info->mach)
>>> {
>>> case bfd_mach_h8300:
>>> - h8300sxmode = 0;
>>> - h8300smode = 0;
>>> - h8300hmode = 0;
>>> set_gdbarch_num_regs (gdbarch, 13);
>>> set_gdbarch_num_pseudo_regs (gdbarch, 1);
>>> set_gdbarch_ecoff_reg_to_regnum (gdbarch,
>>> h8300_dbg_reg_to_regnum);
>>> @@ -1210,9 +1254,6 @@ h8300_gdbarch_init (struct gdbarch_info
>>> break;
>>> case bfd_mach_h8300h:
>>> case bfd_mach_h8300hn:
>>> - h8300sxmode = 0;
>>> - h8300smode = 0;
>>> - h8300hmode = 1;
>>> set_gdbarch_num_regs (gdbarch, 13);
>>> set_gdbarch_num_pseudo_regs (gdbarch, 1);
>>> set_gdbarch_ecoff_reg_to_regnum (gdbarch,
>>> h8300_dbg_reg_to_regnum);
>>> @@ -1222,13 +1263,11 @@ h8300_gdbarch_init (struct
>>> gdbarch_info set_gdbarch_register_name (gdbarch,
>>> h8300_register_name);
>>> if(info.bfd_arch_info->mach != bfd_mach_h8300hn)
>>> {
>>> - h8300_normal_mode = 0;
>>> set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> }
>>> else
>>> {
>>> - h8300_normal_mode = 1;
>>> set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> }
>>> @@ -1238,9 +1277,6 @@ h8300_gdbarch_init (struct gdbarch_info
>>> break;
>>> case bfd_mach_h8300s:
>>> case bfd_mach_h8300sn:
>>> - h8300sxmode = 0;
>>> - h8300smode = 1;
>>> - h8300hmode = 1;
>>> set_gdbarch_num_regs (gdbarch, 16);
>>> set_gdbarch_num_pseudo_regs (gdbarch, 2);
>>> set_gdbarch_ecoff_reg_to_regnum (gdbarch,
>>> h8300s_dbg_reg_to_regnum);
>>> @@ -1250,13 +1286,11 @@ h8300_gdbarch_init (struct
>>> gdbarch_info set_gdbarch_register_name (gdbarch,
>>> h8300s_register_name);
>>> if(info.bfd_arch_info->mach != bfd_mach_h8300sn)
>>> {
>>> - h8300_normal_mode = 0;
>>> set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> }
>>> else
>>> {
>>> - h8300_normal_mode = 1;
>>> set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> }
>>> @@ -1266,9 +1300,6 @@ h8300_gdbarch_init (struct gdbarch_info
>>> break;
>>> case bfd_mach_h8300sx:
>>> case bfd_mach_h8300sxn:
>>> - h8300sxmode = 1;
>>> - h8300smode = 1;
>>> - h8300hmode = 1;
>>> set_gdbarch_num_regs (gdbarch, 18);
>>> set_gdbarch_num_pseudo_regs (gdbarch, 2);
>>> set_gdbarch_ecoff_reg_to_regnum (gdbarch,
>>> h8300s_dbg_reg_to_regnum);
>>> @@ -1278,13 +1309,11 @@ h8300_gdbarch_init (struct
>>> gdbarch_info set_gdbarch_register_name (gdbarch,
>>> h8300sx_register_name);
>>> if(info.bfd_arch_info->mach != bfd_mach_h8300sxn)
>>> {
>>> - h8300_normal_mode = 0;
>>> set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
>>> }
>>> else
>>> {
>>> - h8300_normal_mode = 1;
>>> set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
>>> }
>>> =================================================================================
>>>
>>>
>>
>>
>>
>
>
>
next prev parent reply other threads:[~2003-11-14 20:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-14 8:58 Dhananjay R. Deshpande
2003-11-14 14:49 ` Andrew Cagney
2003-11-14 20:03 ` Michael Snyder
2003-11-14 20:13 ` Michael Snyder [this message]
2003-11-14 21:09 ` Andrew Cagney
2003-12-01 12:58 Dhananjay R. Deshpande
2003-12-01 17:26 ` Andrew Cagney
2003-12-02 13:18 Dhananjay R. Deshpande
2003-12-03 4:24 ` Andrew Cagney
2003-12-10 5:06 Dhananjay R. Deshpande
2003-12-10 17:10 ` Andrew Cagney
2003-12-11 6:52 Dhananjay R. Deshpande
2003-12-16 23:56 ` Michael Snyder
2003-12-17 5:59 Dhananjay R. Deshpande
2003-12-17 19:32 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FB5377F.8040709@redhat.com \
--to=msnyder@redhat.com \
--cc=ac131313@redhat.com \
--cc=dhananjayd@KPITCummins.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox