From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11052 invoked by alias); 24 Feb 2003 20:23:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 11038 invoked from network); 24 Feb 2003 20:23:53 -0000 Received: from unknown (HELO ns2.uk.superh.com) (193.128.105.170) by 172.16.49.205 with SMTP; 24 Feb 2003 20:23:53 -0000 Received: from sh-uk-ex01.uk.w2k.superh.com (sh-uk-ex01 [192.168.16.17]) by ns2.uk.superh.com (8.11.6+Sun/8.11.6) with ESMTP id h1OK5un00999; Mon, 24 Feb 2003 20:05:56 GMT Received: from superh.com ([192.168.16.50]) by sh-uk-ex01.uk.w2k.superh.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 24 Feb 2003 20:23:50 +0000 Message-ID: <3E5A7F58.8C87B17D@superh.com> Date: Mon, 24 Feb 2003 20:23:00 -0000 From: Joern Rennecke Organization: SuperH UK Ltd. X-Accept-Language: en MIME-Version: 1.0 To: Fernando Nasser , gdb@sources.redhat.com, gdb-patches@sources.redhat.com Subject: Re: sh-elf disassembly broken (Was: Re: RFC: Moving disassembler_command to cli land and using newer disassembler code) References: <3E231F8E.72AA3D4A@superh.com> Content-Type: multipart/mixed; boundary="------------195487CEF13A58BE1925CE82" X-OriginalArrivalTime: 24 Feb 2003 20:23:50.0647 (UTC) FILETIME=[A48D4870:01C2DC42] X-SW-Source: 2003-02/txt/msg00602.txt.bz2 This is a multi-part message in MIME format. --------------195487CEF13A58BE1925CE82 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1395 I wrote: > > This patch: > > 2002-11-07 Fernando Nasser > > * printcmd.c (disassemble_command): Remove obsolete function. > (_initialize_printcmd): Do not create disassemble command here. > * cli/cli-cmds.c (disassemble_command): New function. Implements > disassemble command. > (init_cli_cmds): Create disassemble command here instead. > > breaks disassembly for sh-elf (just try to disassemble any > function in any sh-elf object file). > > gdb_disassembly uses TARGET_PRINT_INSN_INFO->mach to initialize > di.mach, but TARGET_PRINT_INSN_INFO->mach is never initialized. > > Before your patch, print_insn had set TARGET_PRINT_INSN_INFO->mach > to TARGET_ARCHITECTURE->mach, which gets expanded to > (gdbarch_bfd_arch_info (current_gdbarch))->mach . And didn't get any reply. So I had a go at writing a conservative patch, which handles the mach field likee tui/tuiDisassem.c:tui_disassemble . Although I have the feeling that TARGET_PRINT_INSN_INFO should be really a local variable of print_insn, and if any information might be missing in the gdbarch struct to initialize TARGET_PRINT_INSN_INFO and asm_info in tui/tuiDisassem.c:tui_disassemble , that should rather be added to the gdbarch struct. -- -------------------------- SuperH (UK) Ltd. 2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX T:+44 1454 465658 --------------195487CEF13A58BE1925CE82 Content-Type: text/plain; charset=us-ascii; name="disas-diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="disas-diff" Content-length: 992 Mon Feb 24 19:59:50 2003 J"orn Rennecke * disasm.c (gdb_disassembly): If TARGET_ARCHITECTURE is non-zero, initialize di.mach from there. Index: disasm.c =================================================================== RCS file: /cvs/src/src/gdb/disasm.c,v retrieving revision 1.4 diff -p -r1.4 disasm.c *** disasm.c 3 Feb 2003 01:18:37 -0000 1.4 --- disasm.c 24 Feb 2003 19:59:47 -0000 *************** gdb_disassembly (struct ui_out *uiout, *** 338,344 **** --- 338,350 ---- di_initialized = 1; } + /* ??? TARGET_PRINT_INSN_INFO is undocumented and only initialized inside + printcmd.c:print_insn , and some strange hacks that access fields of + the variable that underlies the implementation of this macro. */ di.mach = TARGET_PRINT_INSN_INFO->mach; + if (TARGET_ARCHITECTURE != NULL) + di.mach = TARGET_ARCHITECTURE->mach; + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) di.endian = BFD_ENDIAN_BIG; else --------------195487CEF13A58BE1925CE82--