From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88855 invoked by alias); 10 Nov 2016 14:01:19 -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 87847 invoked by uid 89); 10 Nov 2016 14:01:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:AES128-SHA, 00am, sk:arm_gen, mvc X-HELO: mail-wm0-f68.google.com Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Nov 2016 14:01:17 +0000 Received: by mail-wm0-f68.google.com with SMTP id m203so1697470wma.3 for ; Thu, 10 Nov 2016 06:01:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=uc5TscYf9rXo/7tH7RYmWPVMbJL3h7b3iBbHwKXs/iU=; b=FBu2EyQk8/ac+cucJbsr1MA8N8AMRNSo9+Lw5sDwq+SCbMLiD6MX3JHrH1YIdkBYdg rdHrY1InNASVnaBe/fvxnrtK2Rf2yJ7Vgy7fucgSs4y2tSnwde4njdF6kT7+kIW6K9v/ nK9wdbWu7Zjk0ELQneddOOpK/Vbk0bOoxNcmy+d2lDaedFHemMGIUsb6AfWVQhzY+liX AvO1l7ZmV+9UUlLcsrCJEtA0nyAYiCkZWF6kIB/7o/SnO0ST2MrUSgr1mpLWCY0Ry2mQ 2Dn72GwQKVso3LzcCFIu9gopsAxoJH5ooBOxA6PxtsP2CiP5WJp9moHyB2CJSY0gG9MW hf1A== X-Gm-Message-State: ABUngve3W1qPxXe/y9TT/4XASq+YO65F+4hmETirvsIuUfj82dyojPgkIRkd2idFmr2LWA== X-Received: by 10.28.218.213 with SMTP id r204mr5748756wmg.69.1478786474911; Thu, 10 Nov 2016 06:01:14 -0800 (PST) Received: from E107787-LIN (gcc114.osuosl.org. [140.211.9.72]) by smtp.gmail.com with ESMTPSA id g10sm5650146wjw.18.2016.11.10.06.01.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 10 Nov 2016 06:01:14 -0800 (PST) Date: Thu, 10 Nov 2016 14:01:00 -0000 From: Yao Qi To: Antoine Tremblay Cc: gdb-patches@sourceware.org Subject: Re: [PATCH V2 5/5] Support tracepoints for ARM linux in GDBServer Message-ID: <20161110140105.GA31376@E107787-LIN> References: <20161103143300.24934-1-antoine.tremblay@ericsson.com> <20161103143300.24934-6-antoine.tremblay@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161103143300.24934-6-antoine.tremblay@ericsson.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00247.txt.bz2 On Thu, Nov 03, 2016 at 10:33:00AM -0400, Antoine Tremblay wrote: > diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c > index 3f9ff2b..3b3c371 100644 > --- a/gdb/gdbserver/server.c > +++ b/gdb/gdbserver/server.c > @@ -2350,6 +2350,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) > strcat (own_buf, ";EnableDisableTracepoints+"); > strcat (own_buf, ";QTBuffer:size+"); > strcat (own_buf, ";tracenz+"); > + strcat (own_buf, ";TracepointKinds+"); Tracepoint "Kinds" is only useful to arm so far, and it is not needed to other archs support tracepoint, like x86. We should only reply ";TracepointKinds+" on archs where it is useful. > } > > if (target_supports_hardware_single_step () > diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c > index 7700ad1..cdb2c1d 100644 > --- a/gdb/gdbserver/tracepoint.c > +++ b/gdb/gdbserver/tracepoint.c > @@ -747,6 +747,11 @@ struct tracepoint > /* Link to the next tracepoint in the list. */ > struct tracepoint *next; > > + /* Optional kind of the breakpoint to be used. Note this can mean > + different things for different archs as z0 breakpoint command. > + Value is -1 if not persent. */ > + int32_t kind; This field is only useful to trap-based tracepoint. It signals that we need to create a sub-class trap_based_tracepoint of struct tracepoint. > + > #ifndef IN_PROCESS_AGENT > /* The list of actions to take when the tracepoint triggers, in > string/packet form. */ > @@ -1813,6 +1818,7 @@ add_tracepoint (int num, CORE_ADDR addr) > tpoint->compiled_cond = 0; > tpoint->handle = NULL; > tpoint->next = NULL; > + tpoint->kind = -1; > > /* Find a place to insert this tracepoint into list in order to keep > the tracepoint list still in the ascending order. There may be > @@ -2484,6 +2490,7 @@ cmd_qtdp (char *own_buf) > ULONGEST num; > ULONGEST addr; > ULONGEST count; > + ULONGEST kind; > struct tracepoint *tpoint; > char *actparm; > char *packet = own_buf; > @@ -2550,6 +2557,12 @@ cmd_qtdp (char *own_buf) > tpoint->cond = gdb_parse_agent_expr (&actparm); > packet = actparm; > } > + else if (*packet == 'K') > + { > + ++packet; > + packet = unpack_varlen_hex (packet, &kind); > + tpoint->kind = kind; > + } > else if (*packet == '-') > break; > else if (*packet == '\0') > @@ -12293,6 +12307,10 @@ remote_download_tracepoint (struct target_ops *self, struct bp_location *loc) > stepping_actions); > > tpaddr = loc->address; > + > + /* Fetch the proper tracepoint kind. */ > + gdbarch_remote_breakpoint_from_pc (target_gdbarch (), &tpaddr, &kind); > + This function is already removed recently. > sprintf_vma (addrbuf, tpaddr); > xsnprintf (buf, BUF_SIZE, "QTDP:%x:%s:%c:%lx:%x", b->number, > addrbuf, /* address */ > @@ -12367,6 +12385,11 @@ remote_download_tracepoint (struct target_ops *self, struct bp_location *loc) > "ignoring tp %d cond"), b->number); > } > > + /* Tracepoint Kinds are modeled after the breakpoint Z0 kind packet. What do you mean? > diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp > index f225429..a30234f 100644 > --- a/gdb/testsuite/gdb.trace/collection.exp > +++ b/gdb/testsuite/gdb.trace/collection.exp > @@ -764,7 +764,12 @@ proc gdb_trace_collection_test {} { > gdb_collect_expression_test globals_test_func \ > "globalarr\[\(l6, l7\)\]" "7" "a\[\(b, c\)\]" > > - gdb_collect_return_test > + #This architecture has no method to collect a return address. > + if { [is_aarch32_target] } { > + unsupported "collect \$_ret: This architecture has no method to collect a return address" > + } else { > + gdb_collect_return_test > + } You need to implement arm_gen_return_address. > > gdb_collect_strings_test strings_test_func "locstr" "abcdef" "" \ > "local string" > diff --git a/gdb/testsuite/gdb.trace/trace-common.h b/gdb/testsuite/gdb.trace/trace-common.h > index 60cf9e8..9d607f7 100644 > --- a/gdb/testsuite/gdb.trace/trace-common.h > +++ b/gdb/testsuite/gdb.trace/trace-common.h > @@ -40,7 +40,8 @@ x86_trace_dummy () > " call " SYMBOL(x86_trace_dummy) "\n" \ > ) > > -#elif (defined __aarch64__) || (defined __powerpc__) > +#elif (defined __aarch64__) || (defined __powerpc__) \ > + || (defined __arm__ && !defined __thumb__) > > #define FAST_TRACEPOINT_LABEL(name) \ > asm (" .global " SYMBOL(name) "\n" \ > @@ -48,11 +49,18 @@ x86_trace_dummy () > " nop\n" \ > ) > > -#elif (defined __s390__) > +#elif (defined __arm__ && defined __thumb2__) > > #define FAST_TRACEPOINT_LABEL(name) \ > asm (" .global " SYMBOL(name) "\n" \ > SYMBOL(name) ":\n" \ > + " nop.w\n" \ > + ) > + > +#elif (defined __s390__) > +#define FAST_TRACEPOINT_LABEL(name) \ > + asm (" .global " SYMBOL(name) "\n" \ > + SYMBOL(name) ":\n" \ > " mvc 0(8, %r15), 0(%r15)\n" \ > ) > (defined __arm__ && defined __thumb__) (thumb-1) is still not handled. -- Yao (齐尧)