From patchwork Wed Jul 4 16:36:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 28236 Received: (qmail 51419 invoked by alias); 4 Jul 2018 16:36:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 51409 invoked by uid 89); 4 Jul 2018 16:36:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:a5d X-HELO: mail-wm0-f41.google.com Received: from mail-wm0-f41.google.com (HELO mail-wm0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jul 2018 16:36:53 +0000 Received: by mail-wm0-f41.google.com with SMTP id p11-v6so6711049wmc.4 for ; Wed, 04 Jul 2018 09:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id; bh=BvlZuYhA19yX4xzsb3ox9SKY33YLlDJ9jtj6YCk6zZU=; b=A52Bod21LRNfPZ7SscVhfFvVpLE2GJovHiekIirLMQYUEz/15TI5yjUc4QvIo6vBWA Ef+gjeWaHXEfCRTMVY9Opj6gPkV6qHF5m7kwzR5GN9tA6c1KA3SSa/CwYqxml4fwZGiY Hp/PoAyyaeW0j2z2GBBkrEUSbhQin2qiO61wi1BxGwavKa9y/sWT7fvlZ2Spg/thJOZm T7ibZK8QZFlIvjC0tigqYFQRzrk/gQ7ctd8k4VudZbarQ7uJDHBwM3xmSSL/NKzmKCEU ri+QQCvPtSemHlcYhTh5uq4RxxHZBpVbi2G0EElUaN6v9UnqO1XFlXc7YAdV9KqQm+0r GPAg== Return-Path: Received: from localhost (host86-164-199-62.range86-164.btcentralplus.com. [86.164.199.62]) by smtp.gmail.com with ESMTPSA id q140-v6sm6328532wmb.35.2018.07.04.09.36.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 09:36:50 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/testsuite: Ensure test links in malloc and free Date: Wed, 4 Jul 2018 17:36:47 +0100 Message-Id: <20180704163647.4494-1-andrew.burgess@embecosm.com> X-IsSubscribed: yes The test associated with the source file gdb.base/share-env-with-gdbserver.c relies on calling malloc and free within the inferior from GDB. However, as the test source itself makes no use of these functions, there's no requirement that they be linked into the test executable. This commit adds a dummy call to malloc and free to ensure they are linked into the test executable. gdb/testsuite/ChangeLog: * gdb.base/share-env-with-gdbserver.c (main): Add call to malloc/free. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/share-env-with-gdbserver.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c index 2b821cd854..213dde3d6e 100644 --- a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c +++ b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c @@ -29,6 +29,8 @@ my_getenv (const char *name) int main (int argc, char *argv[]) { + /* Call malloc to ensure it is linked in. */ + char *tmp = malloc (1); const char *myvar = getenv ("GDB_TEST_VAR"); if (myvar != NULL) @@ -36,5 +38,6 @@ main (int argc, char *argv[]) else printf ("It failed."); + free (tmp); return 0; /* break-here */ }