From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12114 invoked by alias); 6 Jun 2012 08:55:53 -0000 Received: (qmail 12106 invoked by uid 22791); 6 Jun 2012 08:55:52 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jun 2012 08:55:40 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1ScC1j-0000Cr-KS from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 06 Jun 2012 01:55:39 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 6 Jun 2012 01:55:09 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Wed, 6 Jun 2012 01:55:38 -0700 Message-ID: <4FCF1B02.5020707@codesourcery.com> Date: Wed, 06 Jun 2012 08:55:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Subject: [committed]: [testsuite] Really ensure printf/fprintf are available in dprintf.exp References: <1338554885-3954-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1338554885-3954-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00166.txt.bz2 On 06/01/2012 08:48 PM, Yao Qi wrote: > 2012-06-01 Yao Qi > > * gdb.base/dprintf.c (main): Add extra parameter. > (bar): New function. It is a dead function, but to ensure > 'malloc' is linked explicitly. Patch attached is what I committed (with the typo fixed). http://sourceware.org/ml/gdb-cvs/2012-06/msg00045.html -- Yao (齐尧) 2012-06-06 Yao Qi * gdb.base/dprintf.c (main): Add extra parameter when calling printf and fprintf. (bar): New function. It is a dead function, but to ensure 'malloc' is linked explicitly. RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dprintf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/gdb/testsuite/gdb.base/dprintf.c 2012/05/14 15:38:41 1.1 +++ src/gdb/testsuite/gdb.base/dprintf.c 2012/06/06 08:51:22 1.2 @@ -33,8 +33,8 @@ int loc = 1234; /* Ensure these functions are available. */ - printf ("kickoff\n"); - fprintf (stderr, "also to stderr\n"); + printf ("kickoff %d\n", loc); + fprintf (stderr, "also to stderr %d\n", loc); foo (loc++); foo (loc++); @@ -42,3 +42,17 @@ return g; } +#include +/* Make sure function 'malloc' is linked into program. One some bare-metal + port, if we don't use 'malloc', it will not be linked in program. 'malloc' + is needed, otherwise we'll see such error message + + evaluation of this expression requires the program to have a function + "malloc". */ +void +bar (void) +{ + void *p = malloc (16); + + free (p); +}