From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id 0CA15385840E for ; Wed, 16 Feb 2022 20:47:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0CA15385840E Received: by mail-io1-xd36.google.com with SMTP id a26so1227342iot.6 for ; Wed, 16 Feb 2022 12:47:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BUIYRF9+XQFKQfXPahzQl0FtFW0f+0I70LGDjJa1+EA=; b=2vaeouO2uN/waj5zbdBsfI0ZGrUsIKyh+LTrcLRyxgPPKgkXmEU1AgqE4+0Cm8+9TO JNpCb/Vv0EtX2i0qbORpx5KDbfBzPJiHVIajc5Yxsj2JzYTnsUqaFGP7tnVEp8H19hFI MtnzaxPnXPzf1/72jy9Wytu9lFdZnath4chhuGNgrQLq+hLPuao5DknIZWLSTJduH7my Q0QucUdYlqC9zr+CMHMJ9dkJozDNWsy9qabvxnEkMTeI7q2i7V7/+p3bsd3yON6ylNFN Be4bqCavQpia2uKuZh3iof0ynnhUshpO5Syt436A/NA/vz1rAKQcLsvq1/ilqsKtTG1A IbRQ== X-Gm-Message-State: AOAM533V3s0PtohqD6aXTwr+XmGHRo740wG13kqvx4hF2HsxapmselTl 1UBnHOUl+SlMPDLp3iGtZ7qIKequpqjtog== X-Google-Smtp-Source: ABdhPJzT6CMjCvpfETyIS/wMS1xAP3UCV+9sNFL0hCi04s4he5KLD2pU57mnAtDWkeIZw5M+gyH9MQ== X-Received: by 2002:a05:6638:217c:b0:314:3e9a:bfab with SMTP id p28-20020a056638217c00b003143e9abfabmr2994033jak.268.1645044428369; Wed, 16 Feb 2022 12:47:08 -0800 (PST) Received: from murgatroyd.Home (97-122-95-113.hlrn.qwest.net. [97.122.95.113]) by smtp.gmail.com with ESMTPSA id f15sm591031ila.86.2022.02.16.12.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 12:47:07 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Add constructor to bound_minimal_symbol Date: Wed, 16 Feb 2022 13:47:04 -0700 Message-Id: <20220216204704.66008-1-tromey@adacore.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2022 20:47:11 -0000 This adds a constructor to bound_minimal_symbol, to avoid a build failure with clang that Simon pointed out. I also took the opportunity to remove some redundant initializations, and to change one use of push_back to emplace_back, as suggested by Simon. --- gdb/breakpoint.c | 8 ++++---- gdb/hppa-tdep.c | 2 +- gdb/linespec.c | 3 +-- gdb/minsyms.c | 10 +++++----- gdb/minsyms.h | 8 ++++++++ gdb/psymtab.c | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 9ff2bf82374..a3cfeea6989 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3171,10 +3171,10 @@ static const char *const longjmp_names[] = struct breakpoint_objfile_data { /* Minimal symbol for "_ovly_debug_event" (if any). */ - struct bound_minimal_symbol overlay_msym {}; + struct bound_minimal_symbol overlay_msym; /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any). */ - struct bound_minimal_symbol longjmp_msym[NUM_LONGJMP_NAMES] {}; + struct bound_minimal_symbol longjmp_msym[NUM_LONGJMP_NAMES]; /* True if we have looked for longjmp probes. */ int longjmp_searched = 0; @@ -3184,10 +3184,10 @@ struct breakpoint_objfile_data std::vector longjmp_probes; /* Minimal symbol for "std::terminate()" (if any). */ - struct bound_minimal_symbol terminate_msym {}; + struct bound_minimal_symbol terminate_msym; /* Minimal symbol for "_Unwind_DebugHook" (if any). */ - struct bound_minimal_symbol exception_msym {}; + struct bound_minimal_symbol exception_msym; /* True if we have looked for exception probes. */ int exception_searched = 0; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 7734115b744..760cb1bea13 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2531,7 +2531,7 @@ struct bound_minimal_symbol hppa_lookup_stub_minimal_symbol (const char *name, enum unwind_stub_types stub_type) { - struct bound_minimal_symbol result = { NULL, NULL }; + struct bound_minimal_symbol result; for (objfile *objfile : current_program_space->objfiles ()) { diff --git a/gdb/linespec.c b/gdb/linespec.c index 9e21df76efa..707a3a2586a 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -4273,8 +4273,7 @@ add_minsym (struct minimal_symbol *minsym, struct objfile *objfile, if (!list_mode && !msymbol_is_function (objfile, minsym)) return; - struct bound_minimal_symbol mo = {minsym, objfile}; - msyms->push_back (mo); + msyms->emplace_back (minsym, objfile); return; } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 9a44e4bcf6d..4eab8daabec 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -230,13 +230,13 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, struct found_minimal_symbols { /* External symbols are best. */ - bound_minimal_symbol external_symbol {}; + bound_minimal_symbol external_symbol; /* File-local symbols are next best. */ - bound_minimal_symbol file_symbol {}; + bound_minimal_symbol file_symbol; /* Symbols for shared library trampolines are next best. */ - bound_minimal_symbol trampoline_symbol {}; + bound_minimal_symbol trampoline_symbol; /* Called when a symbol name matches. Check if the minsym is a better type than what we had already found, and record it in one @@ -601,8 +601,8 @@ struct bound_minimal_symbol lookup_minimal_symbol_text (const char *name, struct objfile *objf) { struct minimal_symbol *msymbol; - struct bound_minimal_symbol found_symbol = { NULL, NULL }; - struct bound_minimal_symbol found_file_symbol = { NULL, NULL }; + struct bound_minimal_symbol found_symbol; + struct bound_minimal_symbol found_file_symbol; unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; diff --git a/gdb/minsyms.h b/gdb/minsyms.h index ed31d32483a..519702494ed 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -28,6 +28,14 @@ struct type; struct bound_minimal_symbol { + bound_minimal_symbol (struct minimal_symbol *msym, struct objfile *objf) + : minsym (msym), + objfile (objf) + { + } + + bound_minimal_symbol () = default; + /* The minimal symbol that was found, or NULL if no minimal symbol was found. */ diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ac5009aec37..2aa1d18fed3 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1577,7 +1577,7 @@ maintenance_print_psymbols (const char *args, int from_tty) if (address_arg != NULL) { - struct bound_minimal_symbol msymbol = { NULL, NULL }; + struct bound_minimal_symbol msymbol; /* We don't assume each pc has a unique objfile (this is for debugging). */ -- 2.31.1