From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27333 invoked by alias); 22 Sep 2013 14:42:32 -0000 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 Received: (qmail 27324 invoked by uid 89); 22 Sep 2013 14:42:32 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Sep 2013 14:42:32 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8MEgT3O005086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Sep 2013 10:42:29 -0400 Received: from host2.jankratochvil.net (ovpn-116-46.ams2.redhat.com [10.36.116.46]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8MEgOrQ020018 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 22 Sep 2013 10:42:27 -0400 Date: Sun, 22 Sep 2013 14:42:00 -0000 From: Jan Kratochvil To: "Metzger, Markus T" Cc: "gdb-patches@sourceware.org" , Pedro Alves Subject: Re: [patch v4 20/24] btrace, gdbserver: read branch trace incrementally Message-ID: <20130922144224.GC19149@host2.jankratochvil.net> References: <1372842874-28951-1-git-send-email-markus.t.metzger@intel.com> <1372842874-28951-21-git-send-email-markus.t.metzger@intel.com> <20130818190905.GP24153@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00799.txt.bz2 On Mon, 16 Sep 2013 14:48:42 +0200, Metzger, Markus T wrote: > The -EOVERFLOW return signals a buffer overflow which indicates that > delta trace is not available. GDB then switches to a full read after discarding > the existing trace. Then linux_read_btrace function comment should document this as -EOVERFLOW is specific to its API. But I would find some enum more clear, see below. > The -ENOSYS return signals that the feature is not available. This error is > passed on to the user. + > > TBH returning all these errno codes are not common in GDB, returning -1 > > would make it easier but I do not insist on it. > > I need to distinguish different types of errors, e.g. overflow and not supported. Then use enum. There is for example: enum return_reason { /* User interrupt. */ RETURN_QUIT = -2, /* Any other error. */ RETURN_ERROR }; One could even throw and catch specific exceptions (enum errors) but I find that needlessly overcomplicated when we just return to the immediate caller. Thanks, Jan