From patchwork Thu May 1 21:52:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 787 X-Patchwork-Delegate: alves.ped@gmail.com Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id 4F4DF360072 for ; Thu, 1 May 2014 14:52:37 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id F2D62150EC4C; Thu, 1 May 2014 14:52:36 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id B79B71512433 for ; Thu, 1 May 2014 14:52:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Tq32tO3YAQb60Hnd5W3ZymLnYltT7mh lDbliFBrkC2xME+T6EHZr8RWD33uGEYXt/hFUt2873JqLQYytL6dgoUBmkH2u0jW QneBjHAD5uxXdO+oFyr2TlZOLzybQ5TA48XvpL9JvR1Fw8glDtrFmooKTBNJmHCp xBQ9lYQazhDc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=SYK0c1zesh3+GW7rDkU2ZAIlhEs=; b=UxR/6 DUXo/PcrgcEeD58zr6NBRdIdH/gzVKTMYvCbkxUXrpLzm+ZDzemj0M+tLLwSnkY4 lBZUMtvcJYAZ2VpGkANIGDYyRfqUT68GZutWNswMwu31vMas/tFzLzrOg6ZQNAN1 brKuTL6Mw0K0fPfvikfJteR1ue+3qJwh9p+V8E= Received: (qmail 12021 invoked by alias); 1 May 2014 21:52:25 -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 11949 invoked by uid 89); 1 May 2014 21:52:24 -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, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com 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; Thu, 01 May 2014 21:52:22 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s41LqLRk010081 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 1 May 2014 17:52:21 -0400 Received: from psique.redhat.com ([10.3.113.6]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s41LqH2S001411; Thu, 1 May 2014 17:52:20 -0400 From: Sergio Durigan Junior To: GDB Patches Cc: Sergio Durigan Junior Subject: [PATCH 2/2] Extend recognized types of SDT probe's arguments Date: Thu, 1 May 2014 18:52:11 -0300 Message-Id: <1398981131-11720-3-git-send-email-sergiodj@redhat.com> In-Reply-To: <1398981131-11720-1-git-send-email-sergiodj@redhat.com> References: <1398981131-11720-1-git-send-email-sergiodj@redhat.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in This commit is actually an update to make the parser in gdb/stap-probe.c be aware of all the possible prefixes that a probe argument can have. According to the section "Argument Format" in: The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or unsigned. Currently GDB recognizes only 32 and 64-bit arguments. This commit extends this. Since this is a straightforward extension, I am not submitting a testcase; I can do that if anybody wants. gdb/ 2014-05-01 Sergio Durigan Junior stap-probe.c (enum stap_arg_bitness): New enums to represent 8 and 16-bit signed and unsigned arguments. (stap_parse_probe_arguments): Extend code to handle such arguments. --- gdb/stap-probe.c | 62 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index ef45495..bc7f54a 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -68,6 +68,10 @@ static unsigned int stap_expression_debug = 0; enum stap_arg_bitness { STAP_ARG_BITNESS_UNDEFINED, + STAP_ARG_BITNESS_8BIT_UNSIGNED, + STAP_ARG_BITNESS_8BIT_SIGNED, + STAP_ARG_BITNESS_16BIT_UNSIGNED, + STAP_ARG_BITNESS_16BIT_SIGNED, STAP_ARG_BITNESS_32BIT_UNSIGNED, STAP_ARG_BITNESS_32BIT_SIGNED, STAP_ARG_BITNESS_64BIT_UNSIGNED, @@ -329,6 +333,18 @@ stap_get_expected_argument_type (struct gdbarch *gdbarch, else return builtin_type (gdbarch)->builtin_uint64; + case STAP_ARG_BITNESS_8BIT_UNSIGNED: + return builtin_type (gdbarch)->builtin_uint8; + + case STAP_ARG_BITNESS_8BIT_SIGNED: + return builtin_type (gdbarch)->builtin_int8; + + case STAP_ARG_BITNESS_16BIT_UNSIGNED: + return builtin_type (gdbarch)->builtin_uint16; + + case STAP_ARG_BITNESS_16BIT_SIGNED: + return builtin_type (gdbarch)->builtin_int16; + case STAP_ARG_BITNESS_32BIT_SIGNED: return builtin_type (gdbarch)->builtin_int32; @@ -1095,7 +1111,7 @@ stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch) N@OP - Where `N' can be [+,-][4,8]. This is not mandatory, so + Where `N' can be [+,-][1,2,4,8]. This is not mandatory, so we check it here. If we don't find it, go to the next state. */ if ((cur[0] == '-' && isdigit (cur[1]) && cur[2] == '@') @@ -1108,20 +1124,38 @@ stap_parse_probe_arguments (struct stap_probe *probe, struct gdbarch *gdbarch) got_minus = 1; } - if (*cur == '4') - b = (got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED - : STAP_ARG_BITNESS_32BIT_UNSIGNED); - else if (*cur == '8') - b = (got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED - : STAP_ARG_BITNESS_64BIT_UNSIGNED); - else + /* Defining the bitness. */ + switch (*cur) { - /* We have an error, because we don't expect anything - except 4 and 8. */ - complaint (&symfile_complaints, - _("unrecognized bitness `%c' for probe `%s'"), - *cur, probe->p.name); - return; + case '1': + b = (got_minus ? STAP_ARG_BITNESS_8BIT_SIGNED + : STAP_ARG_BITNESS_8BIT_UNSIGNED); + break; + + case '2': + b = (got_minus ? STAP_ARG_BITNESS_16BIT_SIGNED + : STAP_ARG_BITNESS_16BIT_UNSIGNED); + break; + + case '4': + b = (got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED + : STAP_ARG_BITNESS_32BIT_UNSIGNED); + break; + + case '8': + b = (got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED + : STAP_ARG_BITNESS_64BIT_UNSIGNED); + break; + + default: + { + /* We have an error, because we don't expect anything + except 4 and 8. */ + complaint (&symfile_complaints, + _("unrecognized bitness `%c' for probe `%s'"), + *cur, probe->p.name); + return; + } } arg.bitness = b;