Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: "Dhananjay R. Deshpande" <dhananjayd@KPITCummins.com>
Cc: Andrew Cagney <cagney@gnu.org>,
	Andrew Cagney <ac131313@redhat.com>,
	gdb-patches@sources.redhat.com
Subject: Re: H8300 Patch - Fix GDB crash problem when object file of different H8 cpu is loaded
Date: Wed, 17 Dec 2003 19:32:00 -0000	[thread overview]
Message-ID: <3FE0AF2C.8020407@redhat.com> (raw)
In-Reply-To: <69595093233BB547BB70CF5E492B63F2034027F3@sohm.kpit.com>

Dhananjay R. Deshpande wrote:
> Hi Michael,
> 
> 
>>I'm afraid you need to un-commit it.  This breaks gdb.
>>It no longer works with the simulator for h8s, h8h, or h8sx.
> 
> 
> I did make sure that GDB is working with simulator for H8/300, H8/300H and H8S.
> I am appending the gdb log where output file of each target is loaded in GDB
 > with simulator as target.

Well that's weird -- we must be doing something differently.
I am definitely seeing it fail.

When I build the testcase "movw.s" for "h", "s", or "sx" machine,
and then debug it like this:

	% sh-elf-gdb -nw movw.s.x
	(gdb) target sim
	(gdb) load

I find that GDB knows the target is h8300h (or whatever),
but sim does not.  None of the sim "mode" variables is ever set.


>>As I mentioned earlier in this thread, these global variables
>>that you've replaced are shared between gdb and the sim.  The
>>sim depends on them.  You've split them into essentially
>>gdb's copy and the sim's copy, but now the sim's copy is
>>never getting initialized, becuase it was gdb that
>>initialized the shared ones.  That's why they were shared.
>>
> 
> 
> The SIM sets these variables in set_h8300h called from sim_load. The GDB calls sim_load.

Ah.  Well, sim_load fails.  GDB does not send a bfd pointer,
it only sends the path to the executable file.  Since "abfd"
is null, sim_load tries to open the file with the following call:

   if (abfd != NULL)
     prog_bfd = abfd;
   else
     prog_bfd = bfd_openr (prog, "coff-h8300");

Note the "coff-h8300" parameter.  Since the file isn't coff,
this call returns NULL, and therefore set_h8300h is never
called.



> If you still think that patch should be reverted, I will do that.

Well, I'd like to know what you are doing differently
that makes it work for you, but then I'd like to see
the problem where it fails to work addressed.

By the way -- the symptom for "not working" is that
GDB and SIM disagree about the size of registers,
specifically the PC.  GDB thinks the PC is 4 bytes,
but SIM thinks it is 2 bytes.  Therefore when we
hit a breakpoint at, say, 0x1000, the register value
gets displaced by 16 bits, and comes back as 0x10000000.





  reply	other threads:[~2003-12-17 19:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-17  5:59 Dhananjay R. Deshpande
2003-12-17 19:32 ` Michael Snyder [this message]
2003-12-17 19:54   ` [PATCH] Fix problem with sim_load (h8300) Michael Snyder
  -- strict thread matches above, loose matches on Subject: below --
2003-12-11  6:52 H8300 Patch - Fix GDB crash problem when object file of different H8 cpu is loaded Dhananjay R. Deshpande
2003-12-16 23:56 ` Michael Snyder
2003-12-10  5:06 Dhananjay R. Deshpande
2003-12-10 17:10 ` Andrew Cagney
2003-12-02 13:18 Dhananjay R. Deshpande
2003-12-03  4:24 ` Andrew Cagney
2003-12-01 12:58 Dhananjay R. Deshpande
2003-12-01 17:26 ` Andrew Cagney
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
2003-11-14 21:09       ` Andrew Cagney

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=3FE0AF2C.8020407@redhat.com \
    --to=msnyder@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=cagney@gnu.org \
    --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