From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3006 invoked by alias); 22 Aug 2003 15:42:00 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 2995 invoked from network); 22 Aug 2003 15:41:59 -0000 Received: from unknown (HELO concert.shout.net) (204.253.184.25) by sources.redhat.com with SMTP; 22 Aug 2003 15:41:59 -0000 Received: from duracef.shout.net (duracef.shout.net [204.253.184.12]) by concert.shout.net (8.12.9/8.12.9) with ESMTP id h7MFfmWn023404; Fri, 22 Aug 2003 10:41:48 -0500 Received: from duracef.shout.net (localhost [127.0.0.1]) by duracef.shout.net (8.12.9/8.12.9) with ESMTP id h7MFfmHK013144; Fri, 22 Aug 2003 10:41:48 -0500 Received: (from mec@localhost) by duracef.shout.net (8.12.9/8.12.9/Submit) id h7MFfmQC013143; Fri, 22 Aug 2003 11:41:48 -0400 Date: Fri, 22 Aug 2003 15:42:00 -0000 From: Michael Elizabeth Chastain Message-Id: <200308221541.h7MFfmQC013143@duracef.shout.net> To: gdb@sources.redhat.com, jimb@redhat.com, vinschen@redhat.com Subject: Re: [RFC] Supporting alternative ABIs X-SW-Source: 2003-08/txt/msg00260.txt.bz2 What a coincidence! I have been looking at the code which does this on other platforms. There is code to handle alternate function calling conventions in arm-tdep.c, m68hc11-tdep.c, mips-tdep.c, and sh-tdep.c. These arches store 1 or 2 bits in the minimal symbol (msym) which indicate the calling convention. I'll walk through arm-tdep.c because it is one of the oldest. First, there are some hideous macros to set and retrieve bits in msym->info. I learned about this stuff because I am planning to convert these macros into more normal bit accesses. If you look past the macros, the point is to set bits and test bits on the msym. First, there are gdarch callback hooks, ELF_MAKE_MSYMBOL_SPECIAL and COFF_MAKE_MSYMBOL_SPECIAL. When the Elf reader or Coff reader creates an msym, it calls this gdbarch method. This calls into arm_elf_make_msymbol_special or arm_coff_make_msymbol_special. These functions extract information out of the bfd asymbol (for elf) or the storage class (for coff) reader. They store information about the calling convention in the msym. Later, there is lots of code in arm-tdep.c which checks this bit in the msym to decide what to do. Look at all the calls to arm_pc_is_thumb (pc). Jim's proposal is to put the information in main_type for this platform, rather than putting it in minimal_symbol like arm, m68hc11, sh, and tdep. The big drawback I see is that you don't have main_type information for libraries and unelss the lirbary is compiled with debug info. If all you need this information for is calling functions by hand, this is not bad. But they are different calling conventions: do you also need this information for prologue analysis and frame analysis? Does 'backtrace' depend on this information? Michael C