From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 781F83856244 for ; Sun, 5 Nov 2023 18:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 781F83856244 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 781F83856244 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207901; cv=none; b=TZ/HChSXQt2JXZJK8Zsu8RFQbYDShQ9WsZC9VVE/HsUqu5rhWq4tnbDi/n2KUYZFFK/3cm/j+tIqPB1f7MuyA3YlVKXvKk4SjIrr1ioG8gSXdL3OtM6paFhiZrGqK/jNljs1sydpzZxCZgc4Ynlnw+NhAoXqzlw9kDqagLNILhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207901; c=relaxed/simple; bh=av5rDW10IPfao6/E6YQbAOrNQH8asWRPMKY278vLCdY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=FfOD7lUc6nhlF1Yx/2AfSsXMDiFRaM7NelZvA0afaUDAdtv7hlnq73hhmmD3lUJ3yEuGhiKeS1juEjCR0LMXt954FRsU9n1eSkTkBD+HQoK34gcGpb2MBCUgFwXMLrEHUY2yI3/MW9mcDe/6ghLKyseBaRghPY89m+pPh5mgwQM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5007a.ext.cloudfilter.net ([10.0.29.141]) by cmsmtp with ESMTPS id zMoNqspezKOkLzhayqKH5p; Sun, 05 Nov 2023 18:11:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhaxqzAcB6uHPzhaxqfg1k; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=TuH1ORbh c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=P3_9uBmkC6M_FAiY1AAA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=bQqGfMYJD5NzEVbVD7Xjj+sJZS66/VcDBw2wr/pQb4k=; b=jhIGmY0r9NKcVsCRQsN6/HE3Lw BwlOzXlkTyqa5t8v9M/x5Lb4WlUnbUtt63SljM0BykwylbJkeDRHmkYF1SPcBUwXKOMXj0XimWACw MyFUopUWBt9BIRztbA0a9AZ6w; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qzhaw-003Y66-34 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:06 -0700 Subject: [PATCH v2 28/31] Change btrace_function::sym to a block_symbol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-28-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1qzhaw-003Y66-34 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:51014 X-Source-Auth: tom+tromey.com X-Email-Count: 29 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfFmDkcyl1VGkN+ZdD4xFkQIdPuzRIdgMDwud+3NZSpesTLdKo6tT2FTB/rrkDqzJEpJ73Efvjepeltbn+Hd7uu1CBFtBMI6AUY+DVtCNS+sgqKWVRp9c 1rJO+rep45MK96+5IquZmeWdtFFP2csl6r6Gl9sMMLvRa6GmzYcx89ZvSzeBHFN9KI5Po5ikmh2HNxpfMflH0qy9su6cYyoy9dM= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This changes btrace_function::sym to be a block_symbol, enabling a later patch. --- gdb/btrace.c | 38 +++++++++++++++++++------------------- gdb/btrace.h | 5 +++-- gdb/python/py-record-btrace.c | 2 +- gdb/record-btrace.c | 8 ++++---- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index ea18daa23e0..66b08dabb64 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -78,7 +78,7 @@ ftrace_print_function_name (const struct btrace_function *bfun) struct symbol *sym; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) return sym->print_name (); @@ -98,7 +98,7 @@ ftrace_print_filename (const struct btrace_function *bfun) struct symbol *sym; const char *filename; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) filename = symtab_to_filename_for_display (sym->symtab ()); @@ -192,7 +192,7 @@ ftrace_function_switched (const struct btrace_function *bfun, struct symbol *sym; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; /* If the minimal symbol changed, we certainly switched functions. */ if (mfun != NULL && msym != NULL @@ -235,7 +235,7 @@ ftrace_function_switched (const struct btrace_function *bfun, static struct btrace_function * ftrace_new_function (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { int level; unsigned int number, insn_offset; @@ -311,7 +311,7 @@ ftrace_fixup_caller (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_call (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { const unsigned int length = btinfo->functions.size (); struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun); @@ -331,7 +331,7 @@ ftrace_new_call (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_tailcall (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { const unsigned int length = btinfo->functions.size (); struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun); @@ -414,7 +414,7 @@ ftrace_find_call (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_return (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { struct btrace_function *prev, *bfun, *caller; @@ -424,7 +424,7 @@ ftrace_new_return (struct btrace_thread_info *btinfo, /* It is important to start at PREV's caller. Otherwise, we might find PREV itself, if PREV is a recursive function. */ caller = ftrace_find_call_by_number (btinfo, prev->up); - caller = ftrace_find_caller (btinfo, caller, mfun, fun); + caller = ftrace_find_caller (btinfo, caller, mfun, fun.symbol); if (caller != NULL) { /* The caller of PREV is the preceding btrace function segment in this @@ -496,7 +496,7 @@ ftrace_new_return (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_switch (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { struct btrace_function *prev, *bfun; @@ -524,13 +524,13 @@ ftrace_new_gap (struct btrace_thread_info *btinfo, int errcode, struct btrace_function *bfun; if (btinfo->functions.empty ()) - bfun = ftrace_new_function (btinfo, NULL, NULL); + bfun = ftrace_new_function (btinfo, NULL, {}); else { /* We hijack the previous function segment if it was empty. */ bfun = &btinfo->functions.back (); if (bfun->errcode != 0 || !bfun->insn.empty ()) - bfun = ftrace_new_function (btinfo, NULL, NULL); + bfun = ftrace_new_function (btinfo, NULL, {}); } bfun->errcode = errcode; @@ -550,17 +550,16 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) { struct bound_minimal_symbol bmfun; struct minimal_symbol *mfun; - struct symbol *fun; struct btrace_function *bfun; /* Try to determine the function we're in. We use both types of symbols to avoid surprises when we sometimes get a full symbol and sometimes only a minimal symbol. */ - fun = find_pc_function (pc).symbol; + block_symbol fun = find_pc_function (pc); bmfun = lookup_minimal_symbol_by_pc (pc); mfun = bmfun.minsym; - if (fun == NULL && mfun == NULL) + if (fun.symbol == NULL && mfun == NULL) DEBUG_FTRACE ("no symbol at %s", core_addr_to_string_nz (pc)); /* If we didn't have a function, we create one. */ @@ -629,7 +628,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) { struct btrace_function *caller = ftrace_find_call_by_number (btinfo, bfun->up); - caller = ftrace_find_caller (btinfo, caller, mfun, fun); + caller = ftrace_find_caller (btinfo, caller, mfun, fun.symbol); if (caller != NULL) return ftrace_new_return (btinfo, mfun, fun); } @@ -637,7 +636,8 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) /* If we can't determine the function for PC, we treat a jump at the end of the block as tail call if we're switching functions and as an intra-function branch if we don't. */ - if (start == 0 && ftrace_function_switched (bfun, mfun, fun)) + if (start == 0 && ftrace_function_switched (bfun, mfun, + fun.symbol)) return ftrace_new_tailcall (btinfo, mfun, fun); break; @@ -646,7 +646,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) } /* Check if we're switching functions for some other reason. */ - if (ftrace_function_switched (bfun, mfun, fun)) + if (ftrace_function_switched (bfun, mfun, fun.symbol)) { DEBUG_FTRACE ("switching from %s in %s at %s", ftrace_print_insn_addr (last), @@ -707,7 +707,7 @@ ftrace_match_backtrace (struct btrace_thread_info *btinfo, for (matches = 0; lhs != NULL && rhs != NULL; ++matches) { - if (ftrace_function_switched (lhs, rhs->msym, rhs->sym)) + if (ftrace_function_switched (lhs, rhs->msym, rhs->sym.symbol)) return 0; lhs = ftrace_get_caller (btinfo, lhs); @@ -890,7 +890,7 @@ ftrace_connect_backtrace (struct btrace_thread_info *btinfo, { struct btrace_function *prev, *next; - gdb_assert (!ftrace_function_switched (lhs, rhs->msym, rhs->sym)); + gdb_assert (!ftrace_function_switched (lhs, rhs->msym, rhs->sym.symbol)); /* Connecting LHS and RHS may change the up link. */ prev = lhs; diff --git a/gdb/btrace.h b/gdb/btrace.h index 994af4c459b..9e32ce4da17 100644 --- a/gdb/btrace.h +++ b/gdb/btrace.h @@ -29,6 +29,7 @@ #include "gdbsupport/btrace-common.h" #include "target/waitstatus.h" #include "gdbsupport/enum-flags.h" +#include "block-symbol.h" #if defined (HAVE_LIBIPT) # include @@ -131,7 +132,7 @@ enum btrace_pt_error We do not allow function segments without instructions otherwise. */ struct btrace_function { - btrace_function (struct minimal_symbol *msym_, struct symbol *sym_, + btrace_function (struct minimal_symbol *msym_, block_symbol sym_, unsigned int number_, unsigned int insn_offset_, int level_) : msym (msym_), sym (sym_), insn_offset (insn_offset_), number (number_), level (level_) @@ -140,7 +141,7 @@ struct btrace_function /* The full and minimal symbol for the function. Both may be NULL. */ struct minimal_symbol *msym; - struct symbol *sym; + block_symbol sym; /* The function segment numbers of the previous and next segment belonging to the same function. If a function calls another function, the former will diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index 822ae18e25e..7a51b1f0786 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -341,7 +341,7 @@ recpy_bt_func_symbol (PyObject *self, void *closure) if (func == NULL) return NULL; - if (func->sym == NULL) + if (func->sym.symbol == nullptr) Py_RETURN_NONE; return symbol_to_symbol_object (func->sym); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index abab79f3132..58017822923 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1069,7 +1069,7 @@ btrace_compute_src_line_range (const struct btrace_function *bfun, begin = INT_MAX; end = INT_MIN; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym == NULL) goto out; @@ -1101,7 +1101,7 @@ btrace_call_history_src_line (struct ui_out *uiout, struct symbol *sym; int begin, end; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym == NULL) return; @@ -1135,7 +1135,7 @@ btrace_get_bfun_name (const struct btrace_function *bfun) return "??"; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) return sym->print_name (); @@ -1167,7 +1167,7 @@ btrace_call_history (struct ui_out *uiout, struct symbol *sym; bfun = btrace_call_get (&it); - sym = bfun->sym; + sym = bfun->sym.symbol; msym = bfun->msym; /* Print the function index. */ -- 2.41.0