From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32543 invoked by alias); 2 Apr 2005 00:41:40 -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 32465 invoked from network); 2 Apr 2005 00:41:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 2 Apr 2005 00:41:34 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j320fYnM004025 for ; Fri, 1 Apr 2005 19:41:34 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j320fTO31291 for ; Fri, 1 Apr 2005 19:41:29 -0500 Received: from redhat.com (dhcp-172-16-25-137.sfbay.redhat.com [172.16.25.137]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id j320fRgp002225 for ; Fri, 1 Apr 2005 19:41:28 -0500 Message-ID: <424DEA37.5080301@redhat.com> Date: Sat, 02 Apr 2005 00:41:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20040924 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] mn10300_push_call -- handle structs Content-Type: multipart/mixed; boundary="------------060609010406010006080603" X-SW-Source: 2005-04/txt/msg00021.txt.bz2 This is a multi-part message in MIME format. --------------060609010406010006080603 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 0 --------------060609010406010006080603 Content-Type: text/plain; name="structs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="structs" Content-length: 5226 2005-04-01 Michael Snyder * mn10300-tdep.c (mn10300_frame_unwind_cache): Use find_partial_func instead of unwind_pc to identify frame. (mn10300_push_dummy_call): Handle struct args, struct_return. Index: mn10300-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v retrieving revision 1.120 diff -p -r1.120 mn10300-tdep.c *** mn10300-tdep.c 2 Apr 2005 00:08:14 -0000 1.120 --- mn10300-tdep.c 2 Apr 2005 00:38:07 -0000 *************** mn10300_frame_unwind_cache (struct frame *** 313,319 **** void **this_prologue_cache) { struct trad_frame_cache *cache; ! CORE_ADDR pc; if (*this_prologue_cache) return (*this_prologue_cache); --- 313,319 ---- void **this_prologue_cache) { struct trad_frame_cache *cache; ! CORE_ADDR pc, start, end; if (*this_prologue_cache) return (*this_prologue_cache); *************** mn10300_frame_unwind_cache (struct frame *** 321,330 **** cache = trad_frame_cache_zalloc (next_frame); pc = gdbarch_unwind_pc (current_gdbarch, next_frame); mn10300_analyze_prologue (next_frame, (void **) &cache, pc); ! ! trad_frame_set_id (cache, ! frame_id_build (trad_frame_get_this_base (cache), ! frame_func_unwind (next_frame))); (*this_prologue_cache) = cache; return cache; --- 321,334 ---- cache = trad_frame_cache_zalloc (next_frame); pc = gdbarch_unwind_pc (current_gdbarch, next_frame); mn10300_analyze_prologue (next_frame, (void **) &cache, pc); ! if (find_pc_partial_function (pc, NULL, &start, &end)) ! trad_frame_set_id (cache, ! frame_id_build (trad_frame_get_this_base (cache), ! start)); ! else ! trad_frame_set_id (cache, ! frame_id_build (trad_frame_get_this_base (cache), ! frame_func_unwind (next_frame))); (*this_prologue_cache) = cache; return cache; *************** mn10300_push_dummy_call (struct gdbarch *** 445,459 **** CORE_ADDR struct_addr) { const int push_size = register_size (gdbarch, E_PC_REGNUM); ! int regs_used = struct_return ? 1 : 0; int len, arg_len; int stack_offset = 0; int argnum; ! char *val; /* FIXME temp, don't handle struct args at all. */ if (struct_return) error ("Target doesn't handle struct return"); /* This should be a nop, but align the stack just in case something went wrong. Stacks are four byte aligned on the mn10300. */ --- 449,465 ---- CORE_ADDR struct_addr) { const int push_size = register_size (gdbarch, E_PC_REGNUM); ! int regs_used; int len, arg_len; int stack_offset = 0; int argnum; ! char *val, valbuf[MAX_REGISTER_SIZE]; + #if 0 /* FIXME temp, don't handle struct args at all. */ if (struct_return) error ("Target doesn't handle struct return"); + #endif /* This should be a nop, but align the stack just in case something went wrong. Stacks are four byte aligned on the mn10300. */ *************** mn10300_push_dummy_call (struct gdbarch *** 463,473 **** --- 469,482 ---- XXX This doesn't appear to handle pass-by-invisible reference arguments. */ + regs_used = struct_return ? 1 : 0; for (len = 0, argnum = 0; argnum < nargs; argnum++) { arg_len = (TYPE_LENGTH (value_type (args[argnum])) + 3) & ~3; + #if 0 if (TYPE_CODE (value_type (args[argnum])) == TYPE_CODE_STRUCT) error ("Target does not handle struct args"); + #endif while (regs_used < 2 && arg_len > 0) { regs_used++; *************** mn10300_push_dummy_call (struct gdbarch *** 479,496 **** /* Allocate stack space. */ sp -= len; ! regs_used = struct_return ? 1 : 0; /* Push all arguments onto the stack. */ for (argnum = 0; argnum < nargs; argnum++) { ! /* FIXME what about structs? */ ! arg_len = TYPE_LENGTH (value_type (*args)); ! val = (char *) value_contents (*args); while (regs_used < 2 && arg_len > 0) { ! write_register (regs_used, extract_unsigned_integer (val, ! push_size)); val += push_size; arg_len -= push_size; regs_used++; --- 488,524 ---- /* Allocate stack space. */ sp -= len; ! if (struct_return) ! { ! regs_used = 1; ! write_register (E_D0_REGNUM, struct_addr); ! } ! else ! regs_used = 0; ! /* Push all arguments onto the stack. */ for (argnum = 0; argnum < nargs; argnum++) { ! /* FIXME what about structs? Unions? */ ! if (TYPE_CODE (value_type (*args)) == TYPE_CODE_STRUCT ! && TYPE_LENGTH (value_type (*args)) > 8) ! { ! /* Change to pointer-to-type. */ ! arg_len = push_size; ! store_unsigned_integer (valbuf, push_size, ! VALUE_ADDRESS (*args)); ! val = &valbuf[0]; ! } ! else ! { ! arg_len = TYPE_LENGTH (value_type (*args)); ! val = (char *) value_contents (*args); ! } while (regs_used < 2 && arg_len > 0) { ! write_register (regs_used, ! extract_unsigned_integer (val, push_size)); val += push_size; arg_len -= push_size; regs_used++; --------------060609010406010006080603--