From patchwork Wed Apr 23 18:58:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 656 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 082C4360BAB for ; Wed, 23 Apr 2014 11:58:34 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 9AB9614A5A17; Wed, 23 Apr 2014 11:58:34 -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 50871148CFA1 for ; Wed, 23 Apr 2014 11:58:34 -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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=VZNSGC 98VXjRWPLQSb7x342HjQiLfTXNqulSdi93bLuNa2/Gqvo7ByUfVabYt+GTScnfZw Fqj8Kz2g1TEpu1DRPa4lPm/QcN0RcKV4Ozlt5hSur5R6OUEJXaolqqmaPrXJG+JM G7KpFS15dCDjsuv1DKUPa0gWRUPByFY6cfXNQ= 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; s=default; bh=G0tWnxFVYqjt GDiTmN0T72eDDDc=; b=ER6lv0735hMz5ipB4qwVX2l1NHUlV6+SewD0YHP0K0l/ L1kTfhLzqApEFy/ooRCODxd11/M9MxVNBR9/sPUHmmWBPD+h5YNHbLWvaU9Qe3dO /4jdwiLpArWzk99NDk/f5l84RcKE9h9gWerLJfuOrMND8b6n+UadSsbW7VWblx8= Received: (qmail 25764 invoked by alias); 23 Apr 2014 18:58:32 -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 25753 invoked by uid 89); 23 Apr 2014 18:58:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 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; Wed, 23 Apr 2014 18:58:31 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3NIwTmF010369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 23 Apr 2014 14:58:30 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3NIwSLp020668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 23 Apr 2014 14:58:29 -0400 Message-ID: <53580D54.4070104@redhat.com> Date: Wed, 23 Apr 2014 11:58:28 -0700 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "gdb-patches@sourceware.org ml" Subject: Re: [RFA testsuite 4/5] Introduce mi_make_breakpoint_table References: <534ED173.20404@redhat.com> <87tx9rlm8f.fsf@fleche.redhat.com> In-Reply-To: <87tx9rlm8f.fsf@fleche.redhat.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On 04/17/2014 01:44 PM, Tom Tromey wrote: >>>>>> "Keith" == Keith Seitz writes: > > Keith> 2014-04-15 Keith Seitz > > Keith> * lib/mi-support.exp (mi_list_breakpoints): Delete. > Keith> (mi_make_breakpoint_table): New procedure. > > Thanks, this is ok. > > Keith> + lappend hl "{[mi_build_kv_pairs [list width .* alignment .* \ > Keith> + col_name $nm colhdr $hdr]]}" > > I found this line a bit weird, at first thinking that it should probably > be [list...], but then I realized the "{..}" is probably to match MI output. > So I guess a comment wouldn't hurt here. V2 changes: * Added comment explaining header format I've attached what I will be pushing. Keith testsuite/ChangeLog 2014-04-23 Keith Seitz * lib/mi-support.exp (mi_list_breakpoints): Delete. (mi_make_breakpoint_table): New procedure. diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index a497208..8fd5935 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1242,33 +1242,6 @@ proc mi_create_breakpoint {location test args} { return $bp } -proc mi_list_breakpoints { expected test } { - set fullname ".*" - - set body "" - set first 1 - - foreach item $expected { - if {$first == 0} { - set body "$body," - set first 0 - } - set number [lindex $item 0] - set disp [lindex $item 1] - set func [lindex $item 2] - set file [lindex $item 3] - set line [lindex $item 4] - set address [lindex $item 5] - set body "${body}bkpt=\{number=\"$number\",type=\"breakpoint\",disp=\"$disp\",enabled=\"y\",addr=\"$address\",func=\"$func\",file=\".*$file\",${fullname},line=\"$line\",thread-groups=\\\[\"i1\"\\\],times=\"0\",original-location=\".*\"\}" - set first 0 - } - - verbose -log "Expecting: 666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[$body\\\]\}" - mi_gdb_test "666-break-list" \ - "666\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[$body\\\]\}" \ - $test -} - # Creates varobj named NAME for EXPRESSION. # Name cannot be "-". proc mi_create_varobj { name expression testname } { @@ -2431,3 +2404,43 @@ proc mi_make_breakpoint {args} { append result "}" return $result } + +# Build a breakpoint table regexp given the list of breakpoints in `bp_list', +# constructed by mi_make_breakpoint. +# +# Example: Construct a breakpoint table where the only attributes we +# test for are the existence of three breakpoints numbered 1, 2, and 3. +# +# set bps {} +# lappend bps [mi_make_breakpoint -number 1] +# lappend bps [mi_make_breakpoint -number 2] +# lappned bps [mi_make_breakpoint -number 3] +# mi_make_breakpoint_table $bps +# will return (abbreviated for clarity): +# BreakpointTable={nr_rows="3",nr_cols="6",hdr=[{width=".*",...} ...], +# body=[bkpt={number="1",...},bkpt={number="2",...},bkpt={number="3",...}]} + +proc mi_make_breakpoint_table {bp_list} { + # Build header -- assume a standard header for all breakpoint tables. + set hl {} + foreach {nm hdr} [list number Num type Type disp Disp enabled Enb \ + addr Address what What] { + # The elements here are the MI table headers, which have the + # format: + # {width="7",alignment="-1",col_name="number",colhdr="Num"} + + lappend hl "{[mi_build_kv_pairs [list width .* alignment .* \ + col_name $nm colhdr $hdr]]}" + } + set header "hdr=\\\[[join $hl ,]\\\]" + + # The caller has implicitly supplied the number of columns and rows. + set nc [llength $hl] + set nr [llength $bp_list] + + # Build body -- mi_make_breakpoint has done most of the work. + set body "body=\\\[[join $bp_list ,]\\\]" + + # Assemble the final regexp. + return "BreakpointTable={nr_rows=\"$nr\",nr_cols=\"$nc\",$header,$body}" +}