From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26657 invoked by alias); 11 Jul 2012 21:49:52 -0000 Received: (qmail 26643 invoked by uid 22791); 11 Jul 2012 21:49:51 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vc0-f169.google.com (HELO mail-vc0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jul 2012 21:49:37 +0000 Received: by vcbfl10 with SMTP id fl10so1348739vcb.0 for ; Wed, 11 Jul 2012 14:49:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=Z74VY5rqlYa0MOOeUsrIvbPVXDdJlgPnur7a1CapYj0=; b=TAsuK1H+1DCRdsuvp1AZI7lwr3TQ1jKHj7qL9koEdfLXj8p3k+0tRfEOcP7VTkRBu1 TGZhDUgL9Kh1OH1w78pI3u4DilvPmxSuQS0zkZGBUwmx7CGB3s3OTEO5TXmqbsasY9px kJPqk7TV8yTAYraZjNUJI/8x/jdd1eyHEnq6SEQQjoi8SCo7E+GCOdqH6B51QF0iZR39 JXiBHPhcwDDE8hKC9omskExT9l2GxNkgj5qMj4ZChXJbTDn5eZA2zqZS3Z3O5RgqpnEt UATjILHrnu0fgkSHEpEYv7z7QuGgN3vGJoVgfL81buREx2y3xjeSn093yNw1ZOXN7bIZ pERQ== Received: by 10.221.12.145 with SMTP id pi17mr3221420vcb.48.1342043376222; Wed, 11 Jul 2012 14:49:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.221.12.145 with SMTP id pi17mr3221407vcb.48.1342043375908; Wed, 11 Jul 2012 14:49:35 -0700 (PDT) Received: by 10.52.34.45 with HTTP; Wed, 11 Jul 2012 14:49:35 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 Jul 2012 21:49:00 -0000 Message-ID: Subject: Re: how to print a function's return value From: Doug Evans To: Tom Frank Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQmYqJByc2zngiwrRDuYbcD+nrEWseTl//Al1kEm+HEdJPKFwRm4NMb308LFEEiGw93XWo00HjsZ2IIKkVLueWX2BIYd3arNH8lr+o2YYCeKFAMydcb+iZJqz6UkPvDv5xMCCTsOcfCWWIsUtEAEAJ8WDtOuy50bT5cg38K1KsKXd8BIgES5FGSOKj6XTLfO6fuzPLRv X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00029.txt.bz2 On Wed, Jul 11, 2012 at 8:10 AM, Tom Frank wrote: > hi, > > in source code , there is a fuction call like this : int a = func(param); > > then I debug it with gdb , whein it stop at this line,I want to print > the func's retvalue, which results in a gdb sigtrap,and > > cause gdb to go into a trap, then I can not find where am I . > > I konw there is a command to prevent gdb going to trap like this, > what is that command? Hi. Your question is a bit confusing. If I were to set the sigtrap aside, there are two ways to print func's return value. #1 (gdb) print func(param) IOW call func from gdb. Depending on what func does this may or may not be reasonable. The second way is to either set a breakpoint on func or step into into and then step out of it like this: #2 (gdb) step # step into func (gdb) finish # run until func returns, gdb will print its return value Now, as for sigtrap, I think in order to provide an accurate answer I need more details. An example session log for example.