Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: fnf@intrinsity.com (Fred Fish)
To: ac131313@redhat.com (Andrew Cagney)
Cc: fnf@intrinsity.com (Fred Fish), gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Don't clobber info->mach in gdb_print_insn_mips
Date: Mon, 23 Jun 2003 21:39:00 -0000	[thread overview]
Message-ID: <20030623211823.AEF0E2F2F2C@beeville.vert.intrinsity.com> (raw)
In-Reply-To: <3EF763B4.9080708@redhat.com> from "Andrew Cagney" at Jun 23, 2003 04:31:48 PM

> > info->mach field being clobbered by gdb_print_insn_mips.  The attached
> > patch fixes it, though I'm not sure if this is the correct solution.
> 
> What happens if info->mach is never set?  gdb_disassemble_info should 
> have already set it correctly.

Yes, gdb_disassemble_info sets it correctly, and then gdb_print_insn_mips
clobbers it back to zero.  Here is a typescript showing the order that
various functions are called.

Without my patch, gdb_disassemble_info sets it to a correct value,
gdb_print_insn_mips clobbers it back to zero, and then eventually
choose_arch_by_number gets called with mach==0 (my typescript shows
10611501, the expected value for my port, since I have my patch
installed).  Since choose_arch_by_number then returns zero,
the code in set_default_mips_dis_options that sets mips_isa
never gets executed:

  chosen_arch = choose_arch_by_number (info->mach);
  if (chosen_arch != NULL)
    {
      mips_processor = chosen_arch->processor;
      mips_isa = chosen_arch->isa;
      mips_cp0_names = chosen_arch->cp0_names;
      mips_cp0sel_names = chosen_arch->cp0sel_names;
      mips_cp0sel_names_len = chosen_arch->cp0sel_names_len;
      mips_hwr_names = chosen_arch->hwr_names;
    }

and mips_isa remains set to ISA_MIPS3 from earlier in
set_default_mips_dis_options:

  mips_isa = ISA_MIPS3;

-Fred

============================================================================
fred:intrinsity [35] gdb -nw gdb
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 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 "i386-redhat-linux-gnu"...
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x815f7ae: file /src/intrinsity/sdk/sdk/fsf/gdb/gdb/utils.c, line 800.
Breakpoint 2 at 0x8096c2c: file /src/intrinsity/sdk/sdk/fsf/gdb/gdb/cli/cli-cmds.c, line 191.
Breakpoint 3 at 0x82e8c52: file /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c, line 469.
Breakpoint 4 at 0x82e8d11: file /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c, line 495.
Breakpoint 5 at 0x82ea158: file /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c, line 1209.
Breakpoint 6 at 0x81126cb: file /src/intrinsity/sdk/sdk/fsf/gdb/gdb/mips-tdep.c, line 5273.
Breakpoint 7 at 0x80bb7de: file /src/intrinsity/sdk/sdk/fsf/gdb/gdb/disasm.c, line 318.
(top-gdb) run j
Starting program: /links2/build/intrinsity/sdk/T-mipsisa32-intrinsity-elf/fsf/gdb/gdb/gdb j
GNU gdb 2003-06-22-cvs
Copyright 2003 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=mipsisa32-intrinsity-elf"...
Setting up the environment for debugging gdb.
.gdbinit:5: Error in sourced command file:
Function "internal_error" not defined.
(gdb) x/i main

Breakpoint 7, gdb_disassemble_info (gdbarch=0x859c090, file=0x859a170) at /src/intrinsity/sdk/sdk/fsf/gdb/gdb/disasm.c:318
318                                      (fprintf_ftype) fprintf_filtered);
(top-gdb) c
Continuing.

Breakpoint 6, gdb_print_insn_mips (memaddr=18446744071562199548, info=0xbfffd2a0) at /src/intrinsity/sdk/sdk/fsf/gdb/gdb/mips-tdep.c:5273
5273      memaddr = ADDR_BITS_REMOVE (memaddr);
(top-gdb) c
Continuing.

Breakpoint 5, _print_insn_mips (memaddr=18446744071562199548, info=0xbfffd2a0, endianness=BFD_ENDIAN_BIG) at /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c:1209
1209      set_default_mips_dis_options (info);
(top-gdb) c
Continuing.

Breakpoint 4, set_default_mips_dis_options (info=0xbfffd2a0) at /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c:495
495       mips_isa = ISA_MIPS3;
(top-gdb) c
Continuing.

Breakpoint 3, choose_arch_by_number (mach=10611501) at /src/intrinsity/sdk/sdk/fsf/gdb/opcodes/mips-dis.c:469
469       if (hint_bfd_mach == mach
(top-gdb) c
Continuing.
0x800201fc <main>:      addiu   sp,sp,-256
(gdb) 


  reply	other threads:[~2003-06-23 21:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-23 14:14 Fred Fish
2003-06-23 20:38 ` Andrew Cagney
2003-06-23 21:39   ` Fred Fish [this message]
2003-06-23 21:40     ` Andrew Cagney
2003-06-24  0:51       ` Fred Fish
2003-06-25 21:47         ` Andrew Cagney
2003-06-26 18:00           ` 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=20030623211823.AEF0E2F2F2C@beeville.vert.intrinsity.com \
    --to=fnf@intrinsity.com \
    --cc=ac131313@redhat.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