From patchwork Fri Dec 19 18:43:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126896 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B44634BA2E29 for ; Fri, 19 Dec 2025 18:44:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B44634BA2E29 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 01A064BA2E29 for ; Fri, 19 Dec 2025 18:44:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 01A064BA2E29 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 01A064BA2E29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169869; cv=none; b=kPtR2YtILjBerGTkrVj+L5JK1A3hxwDE+2s5T5stqwkn4z2lRoqo5epN6tRNzEahoqWu+htPMcTTldiSCv3WCPwwsP1uQeh7GJVmkYqswtWcwobf846uHZy2sSc120D8Rxjc93uvT0cPDTv8a4f0VrM38BLxy5rmMAje2upRzTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169869; c=relaxed/simple; bh=E+CPVHwkRMTQEabrChyeWzBULddU++VaJurayWeVFzo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kBlP6X/Z7HVzWSEiqs4RxgLE8k9nKPPDkKV+efMKxT6YCm2CE+ize+HVP2qEynlDONIjqUlu7rdTxp8ItsE/WgLtMPxPLy6syVzTBhHoXdYIuZDDIRNkrPs2CfmU/7ZLky3trmXpR7PvHHddZs6hFVhgkPOsoJHzLhFBcU+cejY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01A064BA2E29 Received: by simark.ca (Postfix) id 8A8C01E048; Fri, 19 Dec 2025 13:44:28 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/6] gdb/buildsym: remove find_symbol_in_list Date: Fri, 19 Dec 2025 13:43:39 -0500 Message-ID: <20251219184426.406228-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org It is unused. Change-Id: Iecc488afeaa123d6ad6e7a2952bb46539ef020a2 --- gdb/buildsym.c | 25 ------------------------- gdb/buildsym.h | 3 --- 2 files changed, 28 deletions(-) base-commit: 4e05bdc73a0f0a598af22829b6ee980afb4d22e2 diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 750f049d7204..e6bb86a6404c 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -135,31 +135,6 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead) (*listhead)->symbol[(*listhead)->nsyms++] = symbol; } -/* Find a symbol named NAME on a LIST. NAME need not be - '\0'-terminated; LENGTH is the length of the name. */ - -struct symbol * -find_symbol_in_list (struct pending *list, char *name, int length) -{ - int j; - const char *pp; - - while (list != NULL) - { - for (j = list->nsyms; --j >= 0;) - { - pp = list->symbol[j]->linkage_name (); - if (*pp == *name && strncmp (pp, name, length) == 0 - && pp[length] == '\0') - { - return (list->symbol[j]); - } - } - list = list->next; - } - return (NULL); -} - /* Record BLOCK on the list of all blocks in the file. Put it after OPBLOCK, or at the beginning if opblock is NULL. This puts the block in the list after all its subblocks. */ diff --git a/gdb/buildsym.h b/gdb/buildsym.h index f7fb2c2c4529..0faf308f7a05 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -449,7 +449,4 @@ using buildsym_compunit_up = std::unique_ptr; extern void add_symbol_to_list (struct symbol *symbol, struct pending **listhead); -extern struct symbol *find_symbol_in_list (struct pending *list, - char *name, int length); - #endif /* GDB_BUILDSYM_H */ From patchwork Fri Dec 19 18:43:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126899 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id DE0034BA2E21 for ; Fri, 19 Dec 2025 18:45:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE0034BA2E21 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 38CFF4BA2E2F for ; Fri, 19 Dec 2025 18:44:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38CFF4BA2E2F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 38CFF4BA2E2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169871; cv=none; b=i/R6jq3/cmmiIOAewKwMQcpoSkjMSAqPPs3HJIdGJKPGbEBTwmTTJY7fSEKrJTYb4k8c0NPvGdoLycrKuffj8AcrczCDnjYHRrln+8WMz3wHCk/GZMPpFLFHPlW2v4fl3SeH6lznDL/l+gF5t1BoaorfXWA5p/kUj7SA4pQ5eEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169871; c=relaxed/simple; bh=YuNBX4QDOMuANanXbYaS+vUkreWI+JVywB7hgXe/BFg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UZTisFFz5LaDI0+8WmtxXjUL3qh1Wa1zzkR3tubAA2W9/SIeAORTgpcdiZbWUA1lVElJUttp7/BWx51lhK+tONZXkiKJ+lHW50wmlIKRXIvL7+ibc95QAR/kIOM955sfCMSRbpE0P1mCO/m3aj5wBD34RWXhOqj2r0nFxYzf1gQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38CFF4BA2E2F Received: by simark.ca (Postfix) id 8F0DC1E0AB; Fri, 19 Dec 2025 13:44:30 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/6] gdb/buildsym: remove context_stack::end_addr Date: Fri, 19 Dec 2025 13:43:40 -0500 Message-ID: <20251219184426.406228-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219184426.406228-1-simon.marchi@efficios.com> References: <20251219184426.406228-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org It is unused. Change-Id: Ie86448552500a049d47118d0306231da0ef9a5e1 --- gdb/buildsym.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 0faf308f7a05..339ac09a1aff 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -111,10 +111,6 @@ struct context_stack CORE_ADDR start_addr; - /* Temp slot for exception handling. */ - - CORE_ADDR end_addr; - /* For error-checking matching push/pop */ int depth; From patchwork Fri Dec 19 18:43:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126897 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id E00894BA23C1 for ; Fri, 19 Dec 2025 18:44:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E00894BA23C1 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 54E164BA2E2D for ; Fri, 19 Dec 2025 18:44:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54E164BA2E2D Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 54E164BA2E2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; cv=none; b=sWoLkoq7mkbubmK/x7gxo9cQyYOZGc49QGiDMuRZc5ZlyLZrF2mDSGRYN11ohjsVmucG8FpBpBYLDnyp8K6liTE92XE0Asu94eENKof1zMZsA4w3cAR9q37mKsBkU+4j7c4nL9wfFbv8FJ6ai1lQmPkMaUh4FVzdj4f1h6czMWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; c=relaxed/simple; bh=OgX6V11o2Tqjg6B9a7rJOuVSgChIlRi3cdWcqNHeSE0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=NHFhs2G+QREVfkjqsD+gsYTPA6kPJacjXI6VytVXjjdQah42bP4n0uu6NgP/CGlbrrUdRE2LVrAx6/5F7TXVtCLlQJtCZZ7po0C5RX5W5+Svr0Cvb+tYjTDDPUFu2L44luFtw6RLpITA6zwTMHk+J7ZFcq/vOu4fRZJIFbX+E7E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54E164BA2E2D Received: by simark.ca (Postfix) id C63D91E048; Fri, 19 Dec 2025 13:44:31 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/6] gdb/buildsym: fix indentation of struct context_stack Date: Fri, 19 Dec 2025 13:43:41 -0500 Message-ID: <20251219184426.406228-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219184426.406228-1-simon.marchi@efficios.com> References: <20251219184426.406228-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org While at it, fixup some comments, remove unnecessary empty lines, remove unnecessary struct keywords. Change-Id: I67a4c8302dfca46417d5f46f5dc0378a066f80c4 --- gdb/buildsym.h | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 339ac09a1aff..8446377c5a6c 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -85,37 +85,29 @@ struct pending blocks, eventually). */ struct context_stack - { - /* Outer locals at the time we entered */ +{ + /* Outer locals at the time we entered. */ + pending *locals; - struct pending *locals; + /* Pending using directives at the time we entered. */ + using_direct *local_using_directives; - /* Pending using directives at the time we entered. */ + /* Pointer into blocklist as of entry. */ + pending_block *old_blocks; - struct using_direct *local_using_directives; + /* Name of function, if any, defining context. */ + symbol *name; - /* Pointer into blocklist as of entry */ + /* Expression that computes the frame base of the lexically enclosing + function, if any. NULL otherwise. */ + dynamic_prop *static_link; - struct pending_block *old_blocks; + /* PC where this context starts. */ + CORE_ADDR start_addr; - /* Name of function, if any, defining context */ - - struct symbol *name; - - /* Expression that computes the frame base of the lexically enclosing - function, if any. NULL otherwise. */ - - struct dynamic_prop *static_link; - - /* PC where this context starts */ - - CORE_ADDR start_addr; - - /* For error-checking matching push/pop */ - - int depth; - - }; + /* For error-checking matching push/pop. */ + int depth; +}; /* Flags associated with a linetable entry. */ From patchwork Fri Dec 19 18:43:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126898 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 6D5584BA2E33 for ; Fri, 19 Dec 2025 18:45:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D5584BA2E33 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 57A404BA2E31 for ; Fri, 19 Dec 2025 18:44:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57A404BA2E31 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57A404BA2E31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; cv=none; b=ayIRXf+sZUYN3hfxdkBC7ZLYnaeHaJk6i4+LNgDtmroRBdzfKzLlkqeiDUJghLsqaYaiT2+203SactYg+/v3yhSUSKW2Jse5CYk9GN8v27vUYMUDDCOVYsvKFabipQMP0TI4fazC8dhzAq9cidsKLchW+deaROTwiIzdpc98XRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; c=relaxed/simple; bh=Iu1oF4eQJtSN3Y4yKbjK67r7MCbHYFnc8oqUazXvAZU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=LIk9rMr3DChUXYxAO5KZs04h2mb/4UWKDP4/8axosabHYOv/22GzS+FjXLdrwWBTCxkPNpX3akuNXI8zKgNfzvuWo8xQD7+rWjpO40lfwm0FEa4YJjs9dT9lLvpxLQvMk3VVi9+vLmvdZP8m9yO1aqCNxFuSh4ZsVFEJcifZ9Eg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57A404BA2E31 Received: by simark.ca (Postfix) id E76451E0B6; Fri, 19 Dec 2025 13:44:31 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 4/6] gdb/buildsym: make buildsym_compunit return a reference Date: Fri, 19 Dec 2025 13:43:42 -0500 Message-ID: <20251219184426.406228-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219184426.406228-1-simon.marchi@efficios.com> References: <20251219184426.406228-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org This is more C++-y. Remove the struct keywords from pop_context just to match. Rename "newobj" to "ctx" in the users of context_stack, because I think the "newobj" name is meaningless. For a later task: I think we should find a better name for context_stack, because it is not a stack (it is an entry in the context stack). Change-Id: Ibc66b910ab0f31b367b99812e0469311a99641c9 --- gdb/buildsym-legacy.c | 4 ++-- gdb/buildsym-legacy.h | 4 ++-- gdb/buildsym.c | 22 +++++++++++----------- gdb/buildsym.h | 4 ++-- gdb/coffread.c | 11 +++++------ gdb/dwarf2/read.c | 15 +++++++-------- 6 files changed, 29 insertions(+), 31 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index 5e9e0422d1b7..ee7fa4c828b8 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -170,14 +170,14 @@ end_compunit_symtab (CORE_ADDR end_addr) return result; } -struct context_stack * +context_stack & push_context (int desc, CORE_ADDR valu) { gdb_assert (buildsym_compunit != nullptr); return buildsym_compunit->push_context (desc, valu); } -struct context_stack +context_stack pop_context () { gdb_assert (buildsym_compunit != nullptr); diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h index 006be225d241..f1178defeca4 100644 --- a/gdb/buildsym-legacy.h +++ b/gdb/buildsym-legacy.h @@ -82,9 +82,9 @@ extern const char *pop_subfile (); extern struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr); -extern struct context_stack *push_context (int desc, CORE_ADDR valu); +extern context_stack &push_context (int desc, CORE_ADDR valu); -extern struct context_stack pop_context (); +extern context_stack pop_context (); extern void record_line (struct subfile *subfile, int line, unrelocated_addr pc); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index e6bb86a6404c..2259caad6ad6 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1061,32 +1061,32 @@ buildsym_compunit::augment_type_symtab () (checkable when you pop it), and the starting PC address of this context. */ -struct context_stack * +context_stack & buildsym_compunit::push_context (int desc, CORE_ADDR valu) { - struct context_stack *newobj = &m_context_stack.emplace_back (); + context_stack &ctx = m_context_stack.emplace_back (); - newobj->depth = desc; - newobj->locals = m_local_symbols; - newobj->old_blocks = m_pending_blocks; - newobj->start_addr = valu; - newobj->local_using_directives = m_local_using_directives; - newobj->name = NULL; + ctx.depth = desc; + ctx.locals = m_local_symbols; + ctx.old_blocks = m_pending_blocks; + ctx.start_addr = valu; + ctx.local_using_directives = m_local_using_directives; + ctx.name = NULL; m_local_symbols = NULL; m_local_using_directives = NULL; - return newobj; + return ctx; } /* Pop a context block. Returns the address of the context block just popped. */ -struct context_stack +context_stack buildsym_compunit::pop_context () { gdb_assert (!m_context_stack.empty ()); - struct context_stack result = m_context_stack.back (); + context_stack result = m_context_stack.back (); m_context_stack.pop_back (); return result; } diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 8446377c5a6c..c2b61b3f9fac 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -306,9 +306,9 @@ struct buildsym_compunit m_producer = producer; } - struct context_stack *push_context (int desc, CORE_ADDR valu); + context_stack &push_context (int desc, CORE_ADDR valu); - struct context_stack pop_context (); + context_stack pop_context (); struct block *end_compunit_symtab_get_static_block (CORE_ADDR end_addr, bool expandable, bool required); diff --git a/gdb/coffread.c b/gdb/coffread.c index cdb2bcfb98db..bbb1598bcbc9 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -745,7 +745,7 @@ coff_symtab_read (minimal_symbol_reader &reader, struct objfile *objfile) { struct gdbarch *gdbarch = objfile->arch (); - struct context_stack *newobj = nullptr; + context_stack *ctx = nullptr; struct coff_symbol coff_symbol; struct coff_symbol *cs = &coff_symbol; static struct internal_syment main_sym; @@ -1029,11 +1029,10 @@ coff_symtab_read (minimal_symbol_reader &reader, context_stack_depth is zero, and complain if not. */ depth = 0; - newobj = push_context (depth, fcn_start_addr); + ctx = &push_context (depth, fcn_start_addr); fcn_cs_saved.c_name = getsymname (&fcn_sym_saved); - newobj->name = - process_coff_symbol (&fcn_cs_saved, - &fcn_aux_saved, objfile); + ctx->name + = process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile); } else if (strcmp (cs->c_name, ".ef") == 0) { @@ -1055,7 +1054,7 @@ coff_symtab_read (minimal_symbol_reader &reader, struct context_stack cstk = pop_context (); /* Stack must be empty now. */ - if (!outermost_context_p () || newobj == NULL) + if (!outermost_context_p () || ctx == nullptr) { complaint (_("Unmatched .ef symbol(s) ignored " "starting at symnum %d"), diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 12f3e5f0e3dd..64cb22348e17 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8505,7 +8505,6 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) dwarf2_per_objfile *per_objfile = cu->per_objfile; struct objfile *objfile = per_objfile->objfile; struct gdbarch *gdbarch = objfile->arch (); - struct context_stack *newobj; CORE_ADDR lowpc; CORE_ADDR highpc; struct attribute *attr, *call_line, *call_file; @@ -8596,27 +8595,27 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) } gdb_assert (cu->get_builder () != nullptr); - newobj = cu->get_builder ()->push_context (0, lowpc); - newobj->name = new_symbol (die, read_type_die (die, cu), cu, templ_func); + context_stack &ctx = cu->get_builder ()->push_context (0, lowpc); + ctx.name = new_symbol (die, read_type_die (die, cu), cu, templ_func); if (dwarf2_func_is_main_p (die, cu)) - set_objfile_main_name (objfile, newobj->name->linkage_name (), + set_objfile_main_name (objfile, ctx.name->linkage_name (), cu->lang ()); /* If there is a location expression for DW_AT_frame_base, record it. */ attr = dwarf2_attr (die, DW_AT_frame_base, cu); if (attr != nullptr) - dwarf2_symbol_mark_computed (attr, newobj->name, cu, 1); + dwarf2_symbol_mark_computed (attr, ctx.name, cu, 1); /* If there is a location for the static link, record it. */ - newobj->static_link = NULL; + ctx.static_link = NULL; attr = dwarf2_attr (die, DW_AT_static_link, cu); if (attr != nullptr) { - newobj->static_link + ctx.static_link = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); - attr_to_dynamic_prop (attr, die, cu, newobj->static_link, + attr_to_dynamic_prop (attr, die, cu, ctx.static_link, cu->addr_type ()); } From patchwork Fri Dec 19 18:43:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126901 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B20F44BA2E1E for ; Fri, 19 Dec 2025 18:46:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B20F44BA2E1E X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 783F94BA2E1E for ; Fri, 19 Dec 2025 18:44:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 783F94BA2E1E Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 783F94BA2E1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; cv=none; b=fENpF0vn9ekdT6V1nY1dNBQRGRgMru50O3thRcig7Cz8bEwHNhp5Fgj/QgIdqlzdX9+l+gONJpgPDqBU3LlntPGe3BurBKVuT5ZceeyLNYZ6yTVEVidRDS/SMcjLZXHrxtQX6QENScw2tGzRKCd89TYD43WI12mO7YEV9gV0WzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; c=relaxed/simple; bh=otAC/90zyBA8SRnOdu16Eo3rO0BhP+aEIcLRhnsA0I0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=URrhCUmTfU9rqkSZveYFhrvVTbcA6SSf/CEWvGmZdyneZjs14Jf/Sm+ApS4jtJLlnjtvAcAjRAJ4KaRKGqlcrvFqkfJYbRsDYP5sm6i2/t9oUUs71KWYz7z2YQGlPkw/tPgDt1FSEHlMKgUGRKdEJGJV7pOIF2/hwaF1376QYxg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 783F94BA2E1E Received: by simark.ca (Postfix) id 0E4F11E0BC; Fri, 19 Dec 2025 13:44:32 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 5/6] gdb/buildsym: add constructor to context_stack Date: Fri, 19 Dec 2025 13:43:43 -0500 Message-ID: <20251219184426.406228-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219184426.406228-1-simon.marchi@efficios.com> References: <20251219184426.406228-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1166.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org This makes it clearer what is set up front vs what is set later by callers. Change-Id: I2ee8d053c068f2b9ca37d48834aa688aeb6c0560 --- gdb/buildsym.c | 15 +++++---------- gdb/buildsym.h | 13 +++++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 2259caad6ad6..bf1698dba794 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1064,17 +1064,12 @@ buildsym_compunit::augment_type_symtab () context_stack & buildsym_compunit::push_context (int desc, CORE_ADDR valu) { - context_stack &ctx = m_context_stack.emplace_back (); + context_stack &ctx + = m_context_stack.emplace_back (m_local_symbols, m_local_using_directives, + m_pending_blocks, valu, desc); - ctx.depth = desc; - ctx.locals = m_local_symbols; - ctx.old_blocks = m_pending_blocks; - ctx.start_addr = valu; - ctx.local_using_directives = m_local_using_directives; - ctx.name = NULL; - - m_local_symbols = NULL; - m_local_using_directives = NULL; + m_local_symbols = nullptr; + m_local_using_directives = nullptr; return ctx; } diff --git a/gdb/buildsym.h b/gdb/buildsym.h index c2b61b3f9fac..96cee966cc82 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -86,6 +86,15 @@ struct pending struct context_stack { + context_stack (pending *locals, using_direct *local_using_directives, + pending_block *old_blocks, CORE_ADDR start_addr, int depth) + : locals (locals), + local_using_directives (local_using_directives), + old_blocks (old_blocks), + start_addr (start_addr), + depth (depth) + {} + /* Outer locals at the time we entered. */ pending *locals; @@ -96,11 +105,11 @@ struct context_stack pending_block *old_blocks; /* Name of function, if any, defining context. */ - symbol *name; + symbol *name = nullptr; /* Expression that computes the frame base of the lexically enclosing function, if any. NULL otherwise. */ - dynamic_prop *static_link; + dynamic_prop *static_link = nullptr; /* PC where this context starts. */ CORE_ADDR start_addr; From patchwork Fri Dec 19 18:43:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 126900 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D68B24BA2E25 for ; Fri, 19 Dec 2025 18:45:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D68B24BA2E25 X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 8E36E4BA2E35 for ; Fri, 19 Dec 2025 18:44:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E36E4BA2E35 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E36E4BA2E35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; cv=none; b=XsXse4hDP8ToFFmXinCm/8z3CABrpxjEMQ4e40bhR9jPQG5deqK8KhAug7yGJn2DtS8twe4BYkLC6uDpc15By6zz60iie5e3S0/m1IVwOjUnzeOvQUa7JEskcoB5RrjzdjVkhkIpK3ZgUkngP5c8j20Z1jy/zR5TSqK/rT983KU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1766169872; c=relaxed/simple; bh=YhOzgyrFU7MfUJnn2UW7v4FDG/J9bACy/YwaWc/yhgo=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ApcaZloI226xgcSxqnftCfstz/orKN26UqaCURYZRLxmsV0GWyC0vv1mViCzl1fv4M4dAnr1Cj3M8/mvKKGtTCYV636SYam1mgilqXfUDvXC+G8k20YqXf77u338s0plERvPw8SfoFT7ZRkgeD2CLH5OvRm+ZHL4t0oXyggkZIo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E36E4BA2E35 Received: by simark.ca (Postfix) id 1AE541E0C2; Fri, 19 Dec 2025 13:44:32 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 6/6] gdb/buildsym: replace struct pending with std::vector Date: Fri, 19 Dec 2025 13:43:44 -0500 Message-ID: <20251219184426.406228-6-simon.marchi@efficios.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219184426.406228-1-simon.marchi@efficios.com> References: <20251219184426.406228-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1165.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_STOCKGEN, LOCAL_AUTHENTICATION_FAIL_DMARC, LOCAL_AUTHENTICATION_FAIL_SPF, POISEN_SPAM_PILL, POISEN_SPAM_PILL_1, POISEN_SPAM_PILL_3, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Replace `struct pending`, a home-made linked list of chunks of symbols, with `std::vector`. This removes manual memory management and simplifies the code. The change starts by switching m_local_symbols, m_file_symbols and m_global_symbols in buildsym_compunit to be vectors, and propagates from there. ~buildsym_compunit no longer needs to manually free the lists (it did not free m_local_symbols, was it on purpose?). add_symbol_to_list just appends the symbol to the vector. Obviously, this sometimes causes a vector reallocation, but it is amortized O(1) and I did not find that it causes a performance degradation (more details later). We could try to reserve some space in the vectors up front if we had an estimate of how many entries we'll have, but I am not sure we really can have a good idea up front. collate_pending_symbols_by_language iterates the vector backwards to keep the existing behavior. I am not sure if this is actually needed. buildsym_compunit::push_context std::moves m_local_symbols, to avoid copying the contents of the vector. I don't think buildsym_compunit::pop_context needs to change, everything should be efficient thanks to NRVO. Users of buildsym_compunit::pop_context use std::move to move context_stack::locals back to m_local_symbols. There is a non-trivial change in coff_read_enum_type, which I can't test easily. I did the following test to see if this change would have a performance impact: - I added a scoped_time_it in maintenance_expand_symtabs, to measure just that step - I use a build of blender compiled with "-O2 -g" - I run: $ ./gdb -q -nx --data-directory=data-directory -iex 'maint set dwarf sync on' -iex "maint set per-command time on" -ex "file /data1/smarchi/blender/build-RelWithDebInfo-gcc/bin/blender" -ex "maint expand windowmanager" -batch - I record the time taken by maintenance_expand_symtabs Before looks like: Time for "maintenance_expand_symtabs": wall 34.311, user 32.335, sys 1.829, user+sys 34.164, 99.6 % CPU Time for "maintenance_expand_symtabs": wall 34.208, user 32.265, sys 1.800, user+sys 34.065, 99.6 % CPU Time for "maintenance_expand_symtabs": wall 34.420, user 32.378, sys 1.894, user+sys 34.272, 99.6 % CPU After looks like: Time for "maintenance_expand_symtabs": wall 34.316, user 32.342, sys 1.838, user+sys 34.180, 99.6 % CPU Time for "maintenance_expand_symtabs": wall 34.318, user 32.347, sys 1.831, user+sys 34.178, 99.6 % CPU Time for "maintenance_expand_symtabs": wall 34.357, user 32.272, sys 1.943, user+sys 34.215, 99.6 % CPU I also measured the execution of the whole command (with "maint set per-command time off" this time). Before looks like: 116.12user 12.61system 1:30.68elapsed 141%CPU (0avgtext+0avgdata 10707780maxresident)k 116.69user 12.33system 1:31.42elapsed 141%CPU (0avgtext+0avgdata 10709132maxresident)k 116.51user 12.57system 1:30.83elapsed 142%CPU (0avgtext+0avgdata 10729880maxresident)k After looks like: 115.75user 12.03system 1:29.35elapsed 143%CPU (0avgtext+0avgdata 10712348maxresident)k 116.41user 12.58system 1:30.94elapsed 141%CPU (0avgtext+0avgdata 10727488maxresident)k 115.91user 11.90system 1:29.36elapsed 143%CPU (0avgtext+0avgdata 10770412maxresident)k Change-Id: I984fdaf47b9bddd840c033a6c6052b007bdcd13d --- gdb/buildsym-legacy.c | 6 +-- gdb/buildsym-legacy.h | 6 +-- gdb/buildsym.c | 84 ++++++++---------------------- gdb/buildsym.h | 43 ++++++---------- gdb/coffread.c | 48 +++++++----------- gdb/dictionary.c | 19 +++---- gdb/dictionary.h | 7 ++- gdb/dwarf2/cu.c | 2 +- gdb/dwarf2/cu.h | 2 +- gdb/dwarf2/read.c | 115 +++++++++++++++++++----------------------- gdb/jit.c | 4 +- 11 files changed, 126 insertions(+), 210 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index ee7fa4c828b8..5bdbd62387bf 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -96,7 +96,7 @@ get_current_subfile () /* See buildsym.h. */ -struct pending ** +std::vector & get_local_symbols () { gdb_assert (buildsym_compunit != nullptr); @@ -105,7 +105,7 @@ get_local_symbols () /* See buildsym.h. */ -struct pending ** +std::vector & get_file_symbols () { gdb_assert (buildsym_compunit != nullptr); @@ -114,7 +114,7 @@ get_file_symbols () /* See buildsym.h. */ -struct pending ** +std::vector & get_global_symbols () { gdb_assert (buildsym_compunit != nullptr); diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h index f1178defeca4..d37ab9777f29 100644 --- a/gdb/buildsym-legacy.h +++ b/gdb/buildsym-legacy.h @@ -136,15 +136,15 @@ extern struct subfile *get_current_subfile (); /* Return the local symbol list. */ -extern struct pending **get_local_symbols (); +extern std::vector &get_local_symbols (); /* Return the file symbol list. */ -extern struct pending **get_file_symbols (); +extern std::vector &get_file_symbols (); /* Return the global symbol list. */ -extern struct pending **get_global_symbols (); +extern std::vector &get_global_symbols (); /* Return the current buildsym_compunit. */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index bf1698dba794..055ba814cb8d 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -83,20 +83,6 @@ buildsym_compunit::~buildsym_compunit () nextsub = subfile->next; delete subfile; } - - struct pending *next, *next1; - - for (next = m_file_symbols; next != NULL; next = next1) - { - next1 = next->next; - xfree ((void *) next); - } - - for (next = m_global_symbols; next != NULL; next = next1) - { - next1 = next->next; - xfree ((void *) next); - } } struct macro_table * @@ -114,25 +100,13 @@ buildsym_compunit::get_macro_table () /* Add a symbol to one of the lists of symbols. */ void -add_symbol_to_list (struct symbol *symbol, struct pending **listhead) +add_symbol_to_list (symbol *symbol, std::vector &list) { - struct pending *link; - /* If this is an alias for another symbol, don't add it. */ if (symbol->linkage_name () && symbol->linkage_name ()[0] == '#') return; - /* We keep PENDINGSIZE symbols in each link of the list. If we - don't have a link with room in it, add a new link. */ - if (*listhead == NULL || (*listhead)->nsyms == PENDINGSIZE) - { - link = XNEW (struct pending); - link->next = *listhead; - *listhead = link; - link->nsyms = 0; - } - - (*listhead)->symbol[(*listhead)->nsyms++] = symbol; + list.push_back (symbol); } /* Record BLOCK on the list of all blocks in the file. Put it after @@ -166,14 +140,13 @@ buildsym_compunit::record_pending_block (struct block *block, struct block * buildsym_compunit::finish_block_internal (struct symbol *symbol, - struct pending **listhead, + std::vector &symbol_list, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end, bool is_global, bool expandable) { struct gdbarch *gdbarch = m_objfile->arch (); - struct pending *next, *next1; struct block *block; struct pending_block *pblock; struct pending_block *opblock; @@ -186,7 +159,7 @@ buildsym_compunit::finish_block_internal if (symbol) { block->set_multidict - (mdict_create_linear (&m_objfile->objfile_obstack, *listhead)); + (mdict_create_linear (&m_objfile->objfile_obstack, symbol_list)); } else { @@ -194,12 +167,12 @@ buildsym_compunit::finish_block_internal { block->set_multidict (mdict_create_hashed_expandable (m_language)); - mdict_add_pending (block->multidict (), *listhead); + mdict_add_pending (block->multidict (), symbol_list); } else { block->set_multidict - (mdict_create_hashed (&m_objfile->objfile_obstack, *listhead)); + (mdict_create_hashed (&m_objfile->objfile_obstack, symbol_list)); } } @@ -257,14 +230,8 @@ buildsym_compunit::finish_block_internal if (static_link != NULL) objfile_register_static_link (m_objfile, block, static_link); - /* Now free the links of the list, and empty the list. */ - - for (next = *listhead; next; next = next1) - { - next1 = next->next; - xfree (next); - } - *listhead = NULL; + /* Now empty the list. */ + symbol_list.clear (); /* Check to be sure that the blocks have an end address that is greater than starting address. */ @@ -355,7 +322,7 @@ buildsym_compunit::finish_block (struct symbol *symbol, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end) { - return finish_block_internal (symbol, &m_local_symbols, + return finish_block_internal (symbol, m_local_symbols, old_blocks, static_link, start, end, false, false); } @@ -776,8 +743,8 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr, if (!required && m_pending_blocks == NULL - && m_file_symbols == NULL - && m_global_symbols == NULL + && m_file_symbols.empty () + && m_global_symbols.empty () && !m_have_line_numbers && m_pending_macros == NULL && m_global_using_directives == NULL) @@ -788,7 +755,7 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr, else { /* Define the STATIC_BLOCK. */ - return finish_block_internal (NULL, get_file_symbols (), NULL, NULL, + return finish_block_internal (NULL, m_file_symbols, NULL, NULL, m_last_source_start_addr, end_addr, false, expandable); } @@ -827,7 +794,7 @@ buildsym_compunit::end_compunit_symtab_from_static_block end_addr = static_block->end (); /* Create the GLOBAL_BLOCK and build the blockvector. */ - finish_block_internal (NULL, get_global_symbols (), NULL, NULL, + finish_block_internal (NULL, m_global_symbols, NULL, NULL, m_last_source_start_addr, end_addr, true, expandable); blockvector_up blockvector = make_blockvector (); @@ -999,20 +966,11 @@ buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr) don't have one. */ static void -set_missing_symtab (struct pending *pending_list, - struct compunit_symtab *cu) +set_missing_symtab (const std::vector &symbols, compunit_symtab *cu) { - struct pending *pending; - int i; - - for (pending = pending_list; pending != NULL; pending = pending->next) - { - for (i = 0; i < pending->nsyms; ++i) - { - if (pending->symbol[i]->symtab () == NULL) - pending->symbol[i]->set_symtab (cu->primary_filetab ()); - } - } + for (symbol *sym : symbols) + if (sym->symtab () == nullptr) + sym->set_symtab (cu->primary_filetab ()); } /* Same as end_compunit_symtab, but for the case where we're adding more symbols @@ -1034,7 +992,7 @@ buildsym_compunit::augment_type_symtab () if (m_have_line_numbers) complaint (_("Line numbers recorded in a type symtab")); - if (m_file_symbols != NULL) + if (!m_file_symbols.empty ()) { struct block *block = blockvector->static_block (); @@ -1045,7 +1003,7 @@ buildsym_compunit::augment_type_symtab () mdict_add_pending (block->multidict (), m_file_symbols); } - if (m_global_symbols != NULL) + if (!m_global_symbols.empty ()) { struct block *block = blockvector->global_block (); @@ -1065,10 +1023,10 @@ context_stack & buildsym_compunit::push_context (int desc, CORE_ADDR valu) { context_stack &ctx - = m_context_stack.emplace_back (m_local_symbols, m_local_using_directives, + = m_context_stack.emplace_back (std::move (m_local_symbols), + m_local_using_directives, m_pending_blocks, valu, desc); - m_local_symbols = nullptr; m_local_using_directives = nullptr; return ctx; diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 96cee966cc82..0b1959be382f 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -68,27 +68,14 @@ struct subfile using subfile_up = std::unique_ptr; -/* Record the symbols defined for each context in a list. We don't - create a struct block for the context until we know how long to - make it. */ - -#define PENDINGSIZE 100 - -struct pending - { - struct pending *next; - int nsyms; - struct symbol *symbol[PENDINGSIZE]; - }; - /* Stack representing unclosed lexical contexts (that will become blocks, eventually). */ struct context_stack { - context_stack (pending *locals, using_direct *local_using_directives, + context_stack (std::vector locals, using_direct *local_using_directives, pending_block *old_blocks, CORE_ADDR start_addr, int depth) - : locals (locals), + : locals (std::move (locals)), local_using_directives (local_using_directives), old_blocks (old_blocks), start_addr (start_addr), @@ -96,7 +83,7 @@ struct context_stack {} /* Outer locals at the time we entered. */ - pending *locals; + std::vector locals; /* Pending using directives at the time we entered. */ using_direct *local_using_directives; @@ -290,19 +277,19 @@ struct buildsym_compunit return m_current_subfile; } - struct pending **get_local_symbols () + std::vector &get_local_symbols () { - return &m_local_symbols; + return m_local_symbols; } - struct pending **get_file_symbols () + std::vector &get_file_symbols () { - return &m_file_symbols; + return m_file_symbols; } - struct pending **get_global_symbols () + std::vector &get_global_symbols () { - return &m_global_symbols; + return m_global_symbols; } void record_debugformat (const char *format) @@ -336,7 +323,7 @@ struct buildsym_compunit void record_pending_block (struct block *block, struct pending_block *opblock); struct block *finish_block_internal (struct symbol *symbol, - struct pending **listhead, + std::vector &symbol_list, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end, @@ -432,18 +419,18 @@ struct buildsym_compunit struct pending_block *m_pending_blocks = nullptr; /* Pending static symbols and types at the top level. */ - struct pending *m_file_symbols = nullptr; + std::vector m_file_symbols; /* Pending global functions and variables. */ - struct pending *m_global_symbols = nullptr; + std::vector m_global_symbols; /* Pending symbols that are local to the lexical context. */ - struct pending *m_local_symbols = nullptr; + std::vector m_local_symbols; }; using buildsym_compunit_up = std::unique_ptr; -extern void add_symbol_to_list (struct symbol *symbol, - struct pending **listhead); +extern void add_symbol_to_list (symbol *symbol, + std::vector &list); #endif /* GDB_BUILDSYM_H */ diff --git a/gdb/coffread.c b/gdb/coffread.c index bbb1598bcbc9..28464b110802 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1122,7 +1122,7 @@ coff_symtab_read (minimal_symbol_reader &reader, symnum); break; } - if (*get_local_symbols () && !outermost_context_p ()) + if (!get_local_symbols ().empty () && !outermost_context_p ()) { tmpaddr = cs->c_value + objfile->text_section_offset (); /* Make a block for the local symbols within. */ @@ -1130,7 +1130,7 @@ coff_symtab_read (minimal_symbol_reader &reader, cstk.start_addr, tmpaddr); } /* Now pop locals of block just finished. */ - *get_local_symbols () = cstk.locals; + get_local_symbols () = std::move (cstk.locals); } break; @@ -2022,24 +2022,21 @@ coff_read_enum_type (int index, int length, int lastsym, struct type *type; int nsyms = 0; int done = 0; - struct pending **symlist; + std::vector *symlist; struct coff_symbol member_sym; struct coff_symbol *ms = &member_sym; struct internal_syment sub_sym; union internal_auxent sub_aux; - struct pending *osyms, *syms; - int o_nsyms; - int n; char *name; int unsigned_enum = 1; type = coff_alloc_type (index); if (within_function) - symlist = get_local_symbols (); + symlist = &get_local_symbols (); else - symlist = get_file_symbols (); - osyms = *symlist; - o_nsyms = osyms ? osyms->nsyms : 0; + symlist = &get_file_symbols (); + + size_t o_nsyms = symlist->size (); while (!done && symnum < lastsym && symnum < nlist_nsyms_global) { @@ -2057,7 +2054,7 @@ coff_read_enum_type (int index, int length, int lastsym, sym->set_loc_class_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); sym->set_value_longest (ms->c_value); - add_symbol_to_list (sym, symlist); + add_symbol_to_list (sym, *symlist); nsyms++; break; @@ -2081,31 +2078,22 @@ coff_read_enum_type (int index, int length, int lastsym, /* Find the symbols for the values and put them into the type. The symbols can be found in the symlist that we put them on - to cause them to be defined. osyms contains the old value - of that symlist; everything up to there was defined by us. */ + to cause them to be defined. o_nsyms is the original size of + that symlist; everything from there to the end was defined by us. */ /* Note that we preserve the order of the enum constants, so that in something like "enum {FOO, LAST_THING=FOO}" we print FOO, not LAST_THING. */ - for (syms = *symlist, n = 0; syms; syms = syms->next) + for (size_t i = o_nsyms, n = 0; i < symlist->size (); i++, n++) { - int j = 0; + symbol *xsym = (*symlist)[i]; - if (syms == osyms) - j = o_nsyms; - for (; j < syms->nsyms; j++, n++) - { - struct symbol *xsym = syms->symbol[j]; - - xsym->set_type (type); - type->field (n).set_name (xsym->linkage_name ()); - type->field (n).set_loc_enumval (xsym->value_longest ()); - if (xsym->value_longest () < 0) - unsigned_enum = 0; - type->field (n).set_bitsize (0); - } - if (syms == osyms) - break; + xsym->set_type (type); + type->field (n).set_name (xsym->linkage_name ()); + type->field (n).set_loc_enumval (xsym->value_longest ()); + if (xsym->value_longest () < 0) + unsigned_enum = 0; + type->field (n).set_bitsize (0); } if (unsigned_enum) diff --git a/gdb/dictionary.c b/gdb/dictionary.c index ca0d4b5298a0..03d1494e24ad 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -919,19 +919,12 @@ struct multidictionary /* A helper function to collate symbols on the pending list by language. */ static gdb::unordered_map> -collate_pending_symbols_by_language (const struct pending *symbol_list) +collate_pending_symbols_by_language (const std::vector &symbol_list) { gdb::unordered_map> nsyms; - for (const pending *list_counter = symbol_list; - list_counter != nullptr; list_counter = list_counter->next) - { - for (int i = list_counter->nsyms - 1; i >= 0; --i) - { - enum language language = list_counter->symbol[i]->language (); - nsyms[language].push_back (list_counter->symbol[i]); - } - } + for (auto it = symbol_list.rbegin (); it != symbol_list.rend (); ++it) + nsyms[(*it)->language ()].push_back (*it); return nsyms; } @@ -940,7 +933,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list) struct multidictionary * mdict_create_hashed (struct obstack *obstack, - const struct pending *symbol_list) + const std::vector &symbol_list) { struct multidictionary *retval = XOBNEW (obstack, struct multidictionary); @@ -982,7 +975,7 @@ mdict_create_hashed_expandable (enum language language) struct multidictionary * mdict_create_linear (struct obstack *obstack, - const struct pending *symbol_list) + const std::vector &symbol_list) { struct multidictionary *retval = XOBNEW (obstack, struct multidictionary); @@ -1120,7 +1113,7 @@ mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym) void mdict_add_pending (struct multidictionary *mdict, - const struct pending *symbol_list) + const std::vector &symbol_list) { gdb::unordered_map> nsyms = collate_pending_symbols_by_language (symbol_list); diff --git a/gdb/dictionary.h b/gdb/dictionary.h index 34306832ed9a..73dc538df24d 100644 --- a/gdb/dictionary.h +++ b/gdb/dictionary.h @@ -34,7 +34,6 @@ struct multidictionary; struct symbol; struct obstack; -struct pending; struct language_defn; /* The creation functions for various implementations of @@ -46,7 +45,7 @@ struct language_defn; extern struct multidictionary * mdict_create_hashed (struct obstack *obstack, - const struct pending *symbol_list); + const std::vector &symbol_list); /* Create a multi-language dictionary of symbols, implemented via a hashtable that grows as necessary. The initial dictionary of @@ -64,7 +63,7 @@ extern struct multidictionary * extern struct multidictionary * mdict_create_linear (struct obstack *obstack, - const struct pending *symbol_list); + const std::vector &symbol_list); /* Create a multi-language dictionary of symbols, implemented via an array that grows as necessary. The multidictionary initially @@ -91,7 +90,7 @@ extern void mdict_add_symbol (struct multidictionary *mdict, /* Utility to add a list of symbols to a multidictionary. */ extern void mdict_add_pending (struct multidictionary *mdict, - const struct pending *symbol_list); + const std::vector &symbol_list); /* A type containing data that is used when iterating over all symbols in a dictionary. Don't ever look at its innards; this type would diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index 6e5a41e2aec8..e62852865134 100644 --- a/gdb/dwarf2/cu.c +++ b/gdb/dwarf2/cu.c @@ -94,7 +94,7 @@ dwarf2_cu::start_compunit_symtab (const char *name, const char *comp_dir, lang (), low_pc); - list_in_scope = get_builder ()->get_file_symbols (); + list_in_scope = &get_builder ()->get_file_symbols (); /* DWARF versions are restricted to [2, 5], thanks to the check in read_comp_unit_head. */ diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h index 68010a060cc3..a8a8c0f7fa40 100644 --- a/gdb/dwarf2/cu.h +++ b/gdb/dwarf2/cu.h @@ -296,7 +296,7 @@ struct dwarf2_cu first local scope, and all other local scopes as nested local scopes, and worked fine. Check to see if we really need to distinguish these in buildsym.c. */ - struct pending **list_in_scope = nullptr; + std::vector *list_in_scope = nullptr; /* Storage for things with the same lifetime as this read-in compilation unit. */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 64cb22348e17..9fad0b9cf6e8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -4333,41 +4333,31 @@ static void fixup_go_packaging (struct dwarf2_cu *cu) { gdb::unique_xmalloc_ptr package_name; - struct pending *list; - int i; - for (list = *cu->get_builder ()->get_global_symbols (); - list != NULL; - list = list->next) - { - for (i = 0; i < list->nsyms; ++i) - { - struct symbol *sym = list->symbol[i]; + for (symbol *sym : cu->get_builder ()->get_global_symbols ()) + if (sym->language () == language_go && sym->loc_class () == LOC_BLOCK) + { + gdb::unique_xmalloc_ptr this_package_name + = go_symbol_package_name (sym); - if (sym->language () == language_go - && sym->loc_class () == LOC_BLOCK) - { - gdb::unique_xmalloc_ptr this_package_name - = go_symbol_package_name (sym); + if (this_package_name == nullptr) + continue; - if (this_package_name == NULL) - continue; - if (package_name == NULL) - package_name = std::move (this_package_name); - else - { - struct objfile *objfile = cu->per_objfile->objfile; - if (strcmp (package_name.get (), this_package_name.get ()) != 0) - complaint (_("Symtab %s has objects from two different Go packages: %s and %s"), - (sym->symtab () != NULL - ? symtab_to_filename_for_display - (sym->symtab ()) - : objfile_name (objfile)), - this_package_name.get (), package_name.get ()); - } - } - } - } + if (package_name == nullptr) + package_name = std::move (this_package_name); + else + { + objfile *objfile = cu->per_objfile->objfile; + + if (strcmp (package_name.get (), this_package_name.get ()) != 0) + complaint (_("Symtab %s has objects from two different Go " + "packages: %s and %s"), + (sym->symtab () != NULL + ? symtab_to_filename_for_display (sym->symtab ()) + : objfile_name (objfile)), + this_package_name.get (), package_name.get ()); + } + } if (package_name != NULL) { @@ -6250,7 +6240,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) cust->dirname (), cust->language (), 0, cust); - list_in_scope = get_builder ()->get_file_symbols (); + list_in_scope = &get_builder ()->get_file_symbols (); } return; } @@ -6304,7 +6294,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) cust->dirname (), cust->language (), 0, cust); - list_in_scope = get_builder ()->get_file_symbols (); + list_in_scope = &get_builder ()->get_file_symbols (); auto &file_names = line_header->file_names (); for (i = 0; i < file_names.size (); ++i) @@ -8270,7 +8260,8 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) /* We're inheriting ORIGIN's children into the scope we'd put DIE's symbols in. */ - struct pending **origin_previous_list_in_scope = origin_cu->list_in_scope; + std::vector *origin_previous_list_in_scope + = origin_cu->list_in_scope; origin_cu->list_in_scope = cu->list_in_scope; if (die->tag != origin_die->tag @@ -8619,7 +8610,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) cu->addr_type ()); } - cu->list_in_scope = cu->get_builder ()->get_local_symbols (); + cu->list_in_scope = &cu->get_builder ()->get_local_symbols (); for (die_info *child_die : die->children ()) { @@ -8702,13 +8693,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) a function declares a class that has methods). This means that when we finish processing a function scope, we may need to go back to building a containing block's symbol lists. */ - *cu->get_builder ()->get_local_symbols () = cstk.locals; + cu->get_builder ()->get_local_symbols () = std::move (cstk.locals); cu->get_builder ()->set_local_using_directives (cstk.local_using_directives); /* If we've finished processing a top-level function, subsequent symbols go in the file symbol list. */ if (cu->get_builder ()->outermost_context_p ()) - cu->list_in_scope = cu->get_builder ()->get_file_symbols (); + cu->list_in_scope = &cu->get_builder ()->get_file_symbols (); } /* Process all the DIES contained within a lexical block scope. Start @@ -8758,7 +8749,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) inherit_abstract_dies (die, cu); struct context_stack cstk = cu->get_builder ()->pop_context (); - if (*cu->get_builder ()->get_local_symbols () != NULL + if (!cu->get_builder ()->get_local_symbols ().empty () || (*cu->get_builder ()->get_local_using_directives ()) != NULL) { struct block *block @@ -8777,7 +8768,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) to do. */ dwarf2_record_block_ranges (die, block, cu); } - *cu->get_builder ()->get_local_symbols () = cstk.locals; + cu->get_builder ()->get_local_symbols () = std::move (cstk.locals); cu->get_builder ()->set_local_using_directives (cstk.local_using_directives); } @@ -16098,7 +16089,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, static void add_ada_export_symbol (struct symbol *orig, const char *new_name, const char *orig_name, struct dwarf2_cu *cu, - struct pending **list_to_add) + std::vector &list_to_add) { struct symbol *copy = new (&cu->per_objfile->objfile->objfile_obstack) symbol (*orig); @@ -16152,7 +16143,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, const char *name; struct attribute *attr = NULL; struct attribute *attr2 = NULL; - struct pending **list_to_add = NULL; + std::vector *list_to_add = nullptr; int inlined_func = (die->tag == DW_TAG_inlined_subroutine); @@ -16278,7 +16269,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, belongs to. */ attr2 = dwarf2_attr (die->parent, DW_AT_external, cu); if (attr2 != nullptr && attr2->as_boolean ()) - list_to_add = cu->get_builder ()->get_global_symbols (); + list_to_add = &cu->get_builder ()->get_global_symbols (); else list_to_add = cu->list_in_scope; break; @@ -16298,7 +16289,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, to be able to access them globally. For instance, we want to be able to break on a nested subprogram without having to specify the context. */ - list_to_add = cu->get_builder ()->get_global_symbols (); + list_to_add = &cu->get_builder ()->get_global_symbols (); } else { @@ -16323,7 +16314,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, name, then create a second symbol that refers back to it. */ add_ada_export_symbol (sym, linkagename, physname, cu, - list_to_add); + *list_to_add); } } break; @@ -16370,7 +16361,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, if (!suppress_add) { if (attr2 != nullptr && attr2->as_boolean ()) - list_to_add = cu->get_builder ()->get_global_symbols (); + list_to_add = &cu->get_builder ()->get_global_symbols (); else list_to_add = cu->list_in_scope; } @@ -16419,8 +16410,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, but it may be block-scoped. */ list_to_add = ((cu->list_in_scope - == cu->get_builder ()->get_file_symbols ()) - ? cu->get_builder ()->get_global_symbols () + == &cu->get_builder ()->get_file_symbols ()) + ? &cu->get_builder ()->get_global_symbols () : cu->list_in_scope); } else @@ -16433,7 +16424,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, be seen here, because it will not have a location and so will be handled below. */ add_ada_export_symbol (sym, physname, linkagename, cu, - list_to_add); + *list_to_add); } } else @@ -16464,8 +16455,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, sym->set_linkage_name (physname); list_to_add = ((cu->list_in_scope - == cu->get_builder ()->get_file_symbols ()) - ? cu->get_builder ()->get_global_symbols () + == &cu->get_builder ()->get_file_symbols ()) + ? &cu->get_builder ()->get_global_symbols () : cu->list_in_scope); SYMBOL_LOCATION_BATON (sym) = (void *) linkagename; sym->set_loc_class_index (ada_imported_index); @@ -16477,8 +16468,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, may be block-scoped. */ list_to_add = ((cu->list_in_scope - == cu->get_builder ()->get_file_symbols ()) - ? cu->get_builder ()->get_global_symbols () + == &cu->get_builder ()->get_file_symbols ()) + ? &cu->get_builder ()->get_global_symbols () : cu->list_in_scope); sym->set_loc_class_index (LOC_UNRESOLVED); @@ -16564,9 +16555,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, { buildsym_compunit *builder = cu->get_builder (); list_to_add - = (cu->list_in_scope == builder->get_file_symbols () - && cu->lang () == language_cplus - ? builder->get_global_symbols () + = ((cu->list_in_scope == &builder->get_file_symbols () + && cu->lang () == language_cplus) + ? &builder->get_global_symbols () : cu->list_in_scope); /* The semantics of C++ state that "struct foo { @@ -16609,21 +16600,21 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, DW_TAG_class_type, etc. block. */ list_to_add - = (cu->list_in_scope == cu->get_builder ()->get_file_symbols () - && cu->lang () == language_cplus - ? cu->get_builder ()->get_global_symbols () + = ((cu->list_in_scope == &cu->get_builder ()->get_file_symbols () + && cu->lang () == language_cplus) + ? &cu->get_builder ()->get_global_symbols () : cu->list_in_scope); break; case DW_TAG_imported_declaration: case DW_TAG_namespace: sym->set_domain (TYPE_DOMAIN); sym->set_loc_class_index (LOC_TYPEDEF); - list_to_add = cu->get_builder ()->get_global_symbols (); + list_to_add = &cu->get_builder ()->get_global_symbols (); break; case DW_TAG_module: sym->set_loc_class_index (LOC_TYPEDEF); sym->set_domain (MODULE_DOMAIN); - list_to_add = cu->get_builder ()->get_global_symbols (); + list_to_add = &cu->get_builder ()->get_global_symbols (); break; case DW_TAG_common_block: sym->set_loc_class_index (LOC_COMMON_BLOCK); @@ -16653,7 +16644,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, } if (list_to_add != NULL) - add_symbol_to_list (sym, list_to_add); + add_symbol_to_list (sym, *list_to_add); /* For the benefit of old versions of GCC, check for anonymous namespaces based on the demangled name. */ diff --git a/gdb/jit.c b/gdb/jit.c index 5123717ac565..92d6026effd2 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -570,7 +570,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) struct type *block_type = builtin_type (objfile->arch ())->builtin_void; new_block->set_multidict - (mdict_create_linear (&objfile->objfile_obstack, NULL)); + (mdict_create_linear (&objfile->objfile_obstack, {})); /* The address range. */ new_block->set_start (gdb_block_iter.begin); new_block->set_end (gdb_block_iter.end); @@ -610,7 +610,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) new_block = new (&objfile->objfile_obstack) block; new_block->set_multidict - (mdict_create_linear (&objfile->objfile_obstack, NULL)); + (mdict_create_linear (&objfile->objfile_obstack, {})); new_block->set_superblock (block_iter); block_iter = new_block;