This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS


On Jul 18, 18:20, Andrew Cagney wrote:
} Subject: Re: [patch rfc] Add NUM_REGS pseudo regs to MIPS
} > Andrew Cagney wrote:
} > 
} >> [ ... ] This adds NUM_REGS pseudo registers to the MIPS [ ... ]
} > 
} > 
} > OK, not a direct reply to your rfc, but it's in the right part of the
} > forest to be causing my problem, so...
} > 
} > I've built a Linux cross MIPS toolchain from a combined source tree,
} > checked out of the sources.redhat.com tree yesterday (6 July), and when
} > I attempt to do anything in the sim with the register set, I hit an
} > assert:
} > 
} > ../../combined/gdb/mips-tdep.c:5669: internal-error: mips_register_sim_regno: Assertion `regnum >= 0 && regnum < NUM_REGS' failed.
} > 
} > Setting breakpoints and doing a nested gdb on the thing reveals that
} > it's trying to display register 90.  The path there is kinda ugly,
} > but here's the trace into gdbarch_num_regs(), which is about to
} > return 90:
} 
} Ok, I can see what is happening, but not why.
} 
} For some reason mips_register_sim_regno is being called with a pseudo 
} register value.  I think that is just wrong. 
} mips_pseudo_register_read/write should have converted that pseudo into a 
} raw :-/
} 
} Unfortunatly the below backtrace doesn't explain why (notice how 
} mips_register_sim_regno doesn't appear?).  Run the gdb and when it 
} internal errors, let it drop a core file, and then run gdb on that vis: 
} gdb mips-linux-gnu-gdb core.  Otherwize run gdb on gdb and set the 
} breakpoint on `internal_error'.

Whoops, sorry 'bout that.  Trying to troubleshoot it, set the trap, but
didn't show my original data.  Bad hacker, no cookie.

[ old backtrace removed ]

The whole gory thing, take 2:

(steve@mustang) 382> gdb ./gdb
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 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"...
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x811034a: file ../../combined/gdb/utils.c, line 807.
Breakpoint 2 at 0x8081416: file ../../combined/gdb/cli/cli-cmds.c, line 191.
(top-gdb) run /users/steve/tmp/t/hello.mips
Starting program: /users/steve/gnu-toolchain/build.mips/gdb/./gdb /users/steve/tmp/t/hello.mips
GNU gdb 2003-07-07-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=mips-elf"...
Setting up the environment for debugging gdb.
.gdbinit:5: Error in sourced command file:
Function "internal_error" not defined.
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x15cc vma 0xa0020000
Loading section .init, size 0x38 vma 0xa00215cc
Loading section .fini, size 0x28 vma 0xa0021604
Loading section .sdata, size 0x18 vma 0xa0021dd8
Loading section .ctors, size 0x8 vma 0xa002162c
Loading section .dtors, size 0x8 vma 0xa0021634
Loading section .eh_frame, size 0x4 vma 0xa002163c
Loading section .data, size 0x790 vma 0xa0021640
Loading section .jcr, size 0x4 vma 0xa0021dd0
Start address 0xa0020004
Transfer rate: 61280 bits in <1 sec.
(gdb) break _start
Breakpoint 1 at 0xa0020004: file ../../../../combined/libgloss/mips/crt0.S, line 74.
(gdb) run
Starting program: /users/steve/tmp/t/hello.mips 

Breakpoint 1, _start () at ../../../../combined/libgloss/mips/crt0.S:74
74              li      v0, STATUS_MASK
Current language:  auto; currently asm
(gdb) info registers
          zero       at       v0       v1       a0       a1       a2       a3

Breakpoint 1, internal_error (file=0x82353a0 "../../combined/gdb/mips-tdep.c", 
    line=5669, string=0x8235375 "%s: Assertion `%s' failed.")
    at ../../combined/gdb/utils.c:807
807       va_start (ap, string);
(top-gdb) info stack
#0  internal_error (file=0x82353a0 "../../combined/gdb/mips-tdep.c", line=5669, 
    string=0x8235375 "%s: Assertion `%s' failed.") at ../../combined/gdb/utils.c:807
#1  0x080dbeb6 in mips_register_sim_regno (regnum=90)
    at ../../combined/gdb/mips-tdep.c:5669
#2  0x080ca201 in gdbarch_register_sim_regno (gdbarch=0x82fdc48, reg_nr=90)
    at ../../combined/gdb/gdbarch.c:4078
#3  0x08125173 in gdbsim_fetch_register (regno=90) at ../../combined/gdb/remote-sim.c:299
#4  0x08093e0b in legacy_read_register_gen (regnum=90, 
    myaddr=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ")
    at ../../combined/gdb/regcache.c:727
#5  0x08113891 in frame_register_unwind (frame=0x82e0f40, regnum=90, 
    optimizedp=0xbffff0e8, lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff014, 
    bufferp=0xbffff140) at ../../combined/gdb/frame.c:534
#6  0x080dbd82 in mips_get_saved_register (
    raw_buffer=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ", optimizedp=0xbffff0e8, 
    addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lvalp=0xbffff0ec)
    at ../../combined/gdb/mips-tdep.c:5603
#7  0x080ca968 in gdbarch_deprecated_get_saved_register (gdbarch=0x82fdc48, 
    raw_buffer=0xbffff140 " ñÿ¿HÜ/\bhñÿ¿î\211\f\bHÜ/\bZ", optimized=0xbffff0e8, 
    addrp=0xbffff0f0, frame=0x82e0f40, regnum=90, lval=0xbffff0ec)
    at ../../combined/gdb/gdbarch.c:4305
#8  0x08113aad in frame_register (frame=0x82e0f40, regnum=90, optimizedp=0xbffff0e8, 
    lvalp=0xbffff0ec, addrp=0xbffff0f0, realnump=0xbffff0fc, bufferp=0xbffff140)
    at ../../combined/gdb/frame.c:577
#9  0x08113ee6 in frame_register_read (frame=0x82e0f40, regnum=90, myaddr=0xbffff140)
    at ../../combined/gdb/frame.c:755
#10 0x080da110 in print_gp_register_row (file=0x82fc890, frame=0x82e0f40, 
    start_regnum=90) at ../../combined/gdb/mips-tdep.c:4302
#11 0x080da389 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890, 
    frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4356
#12 0x080c9fb3 in gdbarch_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890, 
    frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/gdbarch.c:4007
#13 0x080b7e92 in registers_info (addr_exp=0x0, fpregs=0)
    at ../../combined/gdb/infcmd.c:1620
#14 0x0807e526 in do_cfunc (c=0x82d32d8, args=0x0, from_tty=1)
    at ../../combined/gdb/cli/cli-decode.c:53
#15 0x0807fd4e in cmd_func (cmd=0x82d32d8, args=0x0, from_tty=1)
    at ../../combined/gdb/cli/cli-decode.c:1517
#16 0x0810e0e3 in execute_command (p=0x82c6d5e "", from_tty=1)
    at ../../combined/gdb/top.c:716
#17 0x080c3a01 in command_handler (command=0x82c6d50 "info registers")
    at ../../combined/gdb/event-top.c:500
#18 0x080c4041 in command_line_handler (rl=0x8339e60 "info registers")
    at ../../combined/gdb/event-top.c:793
#19 0x081f426b in rl_callback_read_char () at ../../combined/readline/callback.c:123
#20 0x080c33ab in rl_callback_read_char_wrapper (client_data=0x0)
    at ../../combined/gdb/event-top.c:166
#21 0x080c38e2 in stdin_event_handler (error=0, client_data=0x0)
    at ../../combined/gdb/event-top.c:416
#22 0x080c2d10 in handle_file_event (event_file_desc=0)
    at ../../combined/gdb/event-loop.c:721
#23 0x080c27dc in process_event () at ../../combined/gdb/event-loop.c:334
#24 0x080c2821 in gdb_do_one_event (data=0x0) at ../../combined/gdb/event-loop.c:371
#25 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff4c8)
    at ../../combined/gdb/top.c:497
#26 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48, 
    func_args=0xbffff4c8, func_val=0xbffff4c0, func_caught=0xbffff4c4, 
    errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:429
#27 0x0810dda4 in catch_errors (func=0x80c27f8 <gdb_do_one_event>, func_args=0x0, 
    errstring=0x8224580 "", mask=6) at ../../combined/gdb/top.c:509
#28 0x080c285f in start_event_loop () at ../../combined/gdb/event-loop.c:422
#29 0x0807c547 in captured_command_loop (data=0x0) at ../../combined/gdb/main.c:97
#30 0x0810dd6a in do_catch_errors (uiout=0x82f4f48, data=0xbffff638)
    at ../../combined/gdb/top.c:497
#31 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x82f4f48, 
    func_args=0xbffff638, func_val=0xbffff630, func_caught=0xbffff634, 
    errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#32 0x0810dda4 in catch_errors (func=0x807c53c <captured_command_loop>, func_args=0x0, 
    errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#33 0x0807d0eb in captured_main (data=0xbffff920) at ../../combined/gdb/main.c:811
#34 0x0810dd6a in do_catch_errors (uiout=0x829f6e0, data=0xbffff8d8)
    at ../../combined/gdb/top.c:497
#35 0x0810dc52 in catcher (func=0x810dd5c <do_catch_errors>, func_uiout=0x829f6e0, 
    func_args=0xbffff8d8, func_val=0xbffff8d0, func_caught=0xbffff8d4, 
    errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:429
#36 0x0810dda4 in catch_errors (func=0x807c574 <captured_main>, func_args=0xbffff920, 
    errstring=0x8207400 "", mask=6) at ../../combined/gdb/top.c:509
#37 0x0807d113 in gdb_main (args=0xbffff920) at ../../combined/gdb/main.c:820
#38 0x0807c539 in main (argc=2, argv=0xbffff9ac) at ../../combined/gdb/gdb.c:35
#39 0x4006e177 in __libc_start_main (main=0x807c510 <main>, argc=2, ubp_av=0xbffff9ac, 
    init=0x807b874 <_init>, fini=0x82073c0 <_fini>, rtld_fini=0x4000e184 <_dl_fini>, 
    stack_end=0xbffff99c) at ../sysdeps/generic/libc-start.c:129
(top-gdb) up 9
#9  0x08113ee6 in frame_register_read (frame=0x82e0f40, regnum=90, myaddr=0xbffff140)
    at ../../combined/gdb/frame.c:755
755       frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
(top-gdb) list
750     {
751       int optimized;
752       enum lval_type lval;
753       CORE_ADDR addr;
754       int realnum;
755       frame_register (frame, regnum, &optimized, &lval, &addr, &realnum, myaddr);
756
757       /* FIXME: cagney/2002-05-15: This test, is just bogus.
758
759          It indicates that the target failed to supply a value for a
(top-gdb) up
#10 0x080da110 in print_gp_register_row (file=0x82fc890, frame=0x82e0f40, 
    start_regnum=90) at ../../combined/gdb/mips-tdep.c:4302
4302          if (!frame_register_read (frame, regnum, raw_buffer))
(top-gdb) list
4297          if (*REGISTER_NAME (regnum) == '\0')
4298            continue;               /* unused register */
4299          if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == TYPE_CODE_FLT)
4300            break;                  /* end row: reached FP register */
4301          /* OK: get the data in raw format.  */
4302          if (!frame_register_read (frame, regnum, raw_buffer))
4303            error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
4304          /* pad small registers */
4305          for (byte = 0; byte < (MIPS_REGSIZE - REGISTER_VIRTUAL_SIZE (regnum)); byte++)
4306            printf_filtered ("  ");
(top-gdb) up
#11 0x080da389 in mips_print_registers_info (gdbarch=0x82fdc48, file=0x82fc890, 
    frame=0x82e0f40, regnum=-1, all=0) at ../../combined/gdb/mips-tdep.c:4356
4356                regnum = print_gp_register_row (file, frame, regnum);
(top-gdb) list
4351                    regnum = print_fp_register_row (file, frame, regnum);
4352                  else
4353                    regnum += MIPS_NUMREGS; /* skip floating point regs */
4354                }
4355              else
4356                regnum = print_gp_register_row (file, frame, regnum);
4357            }
4358        }
4359    }
4360


Puzzled,

-- 
Steve Watt       KD6GGD  PP-ASEL-IA       Email at  home: steve@watt.com
Chelsio Communications   http://www.chelsio.com/    work: steve@chelsio.com
510 N. Pastoria Ave                                Voice: +1 408 962 3627
Sunnyvale, CA, USA, 94085                            Fax: +1 408 730 2580


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]