From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7995 invoked by alias); 9 Mar 2017 12:25:24 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 7976 invoked by uid 89); 9 Mar 2017 12:25:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=sendmail X-HELO: mail-qk0-f193.google.com Received: from mail-qk0-f193.google.com (HELO mail-qk0-f193.google.com) (209.85.220.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Mar 2017 12:25:20 +0000 Received: by mail-qk0-f193.google.com with SMTP id v125so18963995qkh.1 for ; Thu, 09 Mar 2017 04:25:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/ysHEN5uzD6UHianV29hoD+UCBkYzr7I2o8cJyXzSsk=; b=aMub9Pg3z3j92QVYObSA/FDvtRfOcP5zU2+1t8fReDhvoSQrzhv/eusNlBfdX5kNlX sqt6uu3yzvWcf/7o637Nqv+Hl93hFaUF1UKvEG5jhJiizNRJqj1fifX6rsqSsz2Wzo2y eRZRQNev3nQxIZpJDJ1YfScIfclVth3kRZepCu1jeKMS8kJJF5HI+hoiQCHyguQGwxPa tWwexa2kBFZJEXRTO+Ji0/uhvTt6XfARtmkmFgosrFZij4yEGASZxlJS3B91wQfqZ8sC ZzxhEeKCOrFHMxQcWOLH6e7bw0cqT4500+584EPbnZ0pJ92kNFnrMM3QYfU6gQlED4hg Pm0A== X-Gm-Message-State: AMke39kPiYBYokHtgqX+aKDY3l5WErLUuw4rFwbBjo/NYtoERLC2kuVvF3MLngCAACaFe8wCAnkFdwSdU16b8w== X-Received: by 10.200.48.244 with SMTP id w49mr14115057qta.77.1489062319724; Thu, 09 Mar 2017 04:25:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.55.103.134 with HTTP; Thu, 9 Mar 2017 04:24:59 -0800 (PST) In-Reply-To: References: <20170126202406.32412-1-yyc1992@gmail.com> From: Yichao Yu Date: Thu, 09 Mar 2017 12:25:00 -0000 Message-ID: Subject: Re: [PATCH] Lookup the JIT descriptor symbol first to avoid finding the PLT entry of the breakpoint in the wrong object file. To: gdb@sourceware.org Cc: Yichao Yu , Paul Pluzhnikov , Pedro Alves Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00010.txt.bz2 And ping again. On Fri, Feb 24, 2017 at 2:00 PM, Yichao Yu wrote: > Ping again. > > On Sun, Feb 5, 2017 at 7:46 PM, Yichao Yu wrote: >> Ping. Can anyone please review this? Or is there a better place to post this? >> >> On Thu, Jan 26, 2017 at 3:31 PM, Yichao Yu wrote: >>> On Thu, Jan 26, 2017 at 3:24 PM, Yichao Yu wrote: >>>> Fix 20633 >>> >>> >>> ..... I don't use git send-mail very often and missed the chance to >>> type more comments.... >>> >>> The link to the bug report is >>> https://sourceware.org/bugzilla/show_bug.cgi?id=20633 . I think >>> ideally the interface should find all the global and local symbols and >>> breakpoint on all of them since there isn't an agreement on who will >>> provide it AFAICT (and for example,a process can load multiple copies >>> of statically linked LLVM each providing a jit debugging interface). >>> However, I'm not really sure what's the right function to use for that >>> and it'll probably be a much bigger change so I went for this smaller >>> change that fixes the original issue. >>> >>> Not sure how this should be tested....... =( >>> >>>> --- >>>> gdb/jit.c | 17 ++++++++++------- >>>> 1 file changed, 10 insertions(+), 7 deletions(-) >>>> >>>> diff --git a/gdb/jit.c b/gdb/jit.c >>>> index 158d6d8..d6eb800 100644 >>>> --- a/gdb/jit.c >>>> +++ b/gdb/jit.c >>>> @@ -1051,18 +1051,21 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, >>>> if (ps_data->objfile == NULL) >>>> { >>>> /* Lookup the registration symbol. If it is missing, then we >>>> - assume we are not attached to a JIT. */ >>>> - reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name); >>>> - if (reg_symbol.minsym == NULL >>>> - || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) >>>> - return 1; >>>> + assume we are not attached to a JIT. >>>> + Lookup the descriptor first since looking up the breakpoint might >>>> + return a PLT entry in the wrong file. */ >>>> >>>> - desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, >>>> - reg_symbol.objfile); >>>> + desc_symbol = lookup_minimal_symbol_and_objfile (jit_descriptor_name); >>>> if (desc_symbol.minsym == NULL >>>> || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0) >>>> return 1; >>>> >>>> + reg_symbol = lookup_minimal_symbol (jit_break_name, NULL, >>>> + desc_symbol.objfile); >>>> + if (reg_symbol.minsym == NULL >>>> + || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) >>>> + return 1; >>>> + >>>> objf_data = get_jit_objfile_data (reg_symbol.objfile); >>>> objf_data->register_code = reg_symbol.minsym; >>>> objf_data->descriptor = desc_symbol.minsym; >>>> -- >>>> 2.10.2 >>>>