From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4679 invoked by alias); 12 Aug 2013 13:41:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4670 invoked by uid 89); 12 Aug 2013 13:41:31 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.2 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 12 Aug 2013 13:41:28 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1V8sNA-0003Y9-U6 from Luis_Gustavo@mentor.com ; Mon, 12 Aug 2013 06:41:24 -0700 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 12 Aug 2013 06:41:25 -0700 Received: from [172.30.2.104] ([172.30.2.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Aug 2013 06:41:24 -0700 Message-ID: <5208E601.6070000@codesourcery.com> Date: Mon, 12 Aug 2013 13:41:00 -0000 From: Luis Machado Reply-To: lgustavo@codesourcery.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yao Qi CC: Pedro Alves , "'gdb-patches@sourceware.org'" , Mike Frysinger Subject: Re: [PATCH, gdbserver] Further cleanup of FDPIC/DSBT divergences References: <51C34F14.8070803@codesourcery.com> <51C84CBD.10506@codesourcery.com> <51C84DD4.4090001@codesourcery.com> <5203CA36.5000206@codesourcery.com> <520505D9.8080103@redhat.com> <520524D8.40408@codesourcery.com> <52058A17.2050101@codesourcery.com> In-Reply-To: <52058A17.2050101@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00315.txt.bz2 Hi, On 08/09/2013 09:32 PM, Yao Qi wrote: > On 08/10/2013 01:20 AM, Luis Machado wrote: >> +/* Scan for DYNTAG in .dynamic section of ABFD. If DYNTAG is found 1 >> + is returned and the corresponding PTR is set. We only search in >> + the BFD, not in the target's memory. */ >> + >> +static int >> +scan_dyntag_in_bfd (int dyntag, bfd *abfd, CORE_ADDR *ptr) > > Luis, > We've already have a function scan_dyntag in solib-dsbt.c which reads > in both BFD and the target memory. There are some duplications in > scan_dyntag and scan_dyntag_in_bfd. We can combine them into one > function, probably. I seem to recall the code to read target memory, in the case of targets that do relocations based on loadmaps, get this information wrong, based on past experience with a different DSBT-based target. From what i recall, it tries to read the dsbt_index from the main executable's .dynamic, but the information is in the solib's .dynamic section. I can't be sure it works for c6x since there is no target for me to test on. If someone has access to that, i can coordinate some testing. This is the biggest problem right now. > > >> +/* Given a shared library filename, load it up and find >> + out what is its dsbt index. */ >> + >> +static int >> +fetch_solib_dsbt_index (const char *filename) >> +{ >> + unsigned long dsbt_index; >> + CORE_ADDR addr; >> + bfd *solib_bfd = NULL; >> + volatile struct gdb_exception ex; >> + >> + if (filename == NULL) >> + return -1; >> + >> + /* Open the shared library. */ >> + TRY_CATCH (ex, RETURN_MASK_ALL) >> + { >> + solib_bfd = solib_bfd_open ((char *) filename); >> + } >> + if (solib_bfd == NULL) >> + { >> + return -1; >> + } > > Unnecessary braces. Fixed. > >> + >> + /* Fetch the DSBT_INDEX from the shared library file on disk. */ >> + if (scan_dyntag_in_bfd (DT_TIC6X_DSBT_INDEX, solib_bfd, &addr) == 0) > > I don't find the definition of DT_TIC6X_DSBT_INDEX. In uclibc, I only > find DT_C6000_DSBT_INDEX. > That is exactly what it is. I named it DT_TIC6X_DSBT_INDEX to make it more meaningful, but i can use DT_C6000_DSBT_INDEX without problems i think.