From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40661 invoked by alias); 5 Mar 2019 21:48:50 -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 40558 invoked by uid 89); 5 Mar 2019 21:48:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:871 X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Mar 2019 21:48:37 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 07A0E231F2 for ; Tue, 5 Mar 2019 15:48:35 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 1HvPhZcaSdnCe1HvPhUjj5; Tue, 05 Mar 2019 15:48:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DASCjAZFBvhBsSDVaPA4F1gxAPq3oC49cV4SB6s7eis=; b=DJGyqabD5ZSR4eRBNCeRPwuwIr 3M2uszv33TvcAhfGDQZFaVHBZPX3rKOr7eaYfa9RwvfqX76XsGywWDvZsYwfiCI7hZqALlsLcMknD E37dS2xLWiVyFZcYLINt1vJY1; Received: from 75-166-85-218.hlrn.qwest.net ([75.166.85.218]:55840 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h1HvO-000kWQ-Pw; Tue, 05 Mar 2019 15:48:34 -0600 From: Tom Tromey To: Kevin Buettner Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 2/5] Add python method InferiorThread.thread_handle References: <20190227192416.613752c8@f29-4.lan> <20190227193107.5c55cc03@f29-4.lan> Date: Tue, 05 Mar 2019 21:48:00 -0000 In-Reply-To: <20190227193107.5c55cc03@f29-4.lan> (Kevin Buettner's message of "Wed, 27 Feb 2019 19:31:07 -0700") Message-ID: <87ef7lq9fx.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-03/txt/msg00075.txt.bz2 >>>>> "Kevin" == Kevin Buettner writes: Kevin> +/* Implementation of gdb.InferiorThread.thread_handle (self) -> handle. */ What would you think of just the name "handle"? The "thread" part seemed redundant to me. Kevin> + gdb::byte_vector hv = target_thread_info_to_thread_handle (thread_obj->thread); In general, calls into gdb from Python require a try/catch. It can be ok if you're 100% sure a throw is not only not possible but will never be possible. (I feel like we normally ignore out-of-memory exceptions when deciding this, but that's probably a bad idea.) Kevin> + PyObject *object = PyBytes_FromStringAndSize ((const char *) hv.data (), Kevin> + hv.size()); I thought this wasn't available in Python 2 but I see it is used unconditionally in py-record-btrace.c. Tom