From patchwork Wed Feb 5 11:37:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 37689 Received: (qmail 89587 invoked by alias); 5 Feb 2020 11:37: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 89479 invoked by uid 89); 5 Feb 2020 11:37:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=meaningless, sk:header X-HELO: mail-wr1-f66.google.com Received: from mail-wr1-f66.google.com (HELO mail-wr1-f66.google.com) (209.85.221.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Feb 2020 11:37:24 +0000 Received: by mail-wr1-f66.google.com with SMTP id m16so2260471wrx.11 for ; Wed, 05 Feb 2020 03:37:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=WQdvyBfrp1wpm0GjbJfatOjqGlZ+bo4My1B3vTicZYM=; b=MvDJYYMmR5ix0/PGGuRicrxAlve4tNKu8LTNvfCk0Ebztp20VoYShdx7+PnvJsO2aj gH0HfHscAyeAN8BH1ROGX1Ky7oz5Nd9Gnf3MoN2BI3Wrq63YGP69qTmw/h+khnaScIOD cCOSUfU2XiWP79FA/ajO3oxSOFGclH9qeKaONIJUiA/bvJ2JO1AoEs5rI7q6nssLX/g5 1XhTP3+UXGmeELAtODuNCYfHlDVFpe3GbgNq/gUdSju1+vLtAKTrC9ZmrDPZgumyJ8cH wVNW7HGkvywnFNY0FlbVnKyGKMjACt6lk9n4TjVO2LwRF9V31rEC83Au5kb3VX5DArp3 QpWg== Return-Path: Received: from localhost ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id e22sm31854426wrc.13.2020.02.05.03.37.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Feb 2020 03:37:21 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Bernd Edlinger , Andrew Burgess Subject: [PATCH 1/2] gdb/testsuite: Add is-stmt support to the DWARF compiler Date: Wed, 5 Feb 2020 11:37:17 +0000 Message-Id: <74c5be40fdb4818a20460ec8a6e74497b3d24bd5.1580902412.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This commit adds the ability to set and toggle the DWARF line table is-stmt flag. A DWARF line table can now be created with the attribute 'default_is_stmt' like this: lines {version 2 default_is_stmt 0} label { ... } If 'default_is_stmt' is not specified then the current default is 1, which matches the existing behaviour. Inside the DWARF line table program you can now make use of {DW_LNS_negate_stmt} to toggle the is-stmt flag, for example this meaningless program: lines {version 2 default_is_stmt 0} label { include_dir "some_directory" file_name "some_filename" 1 program { {DW_LNS_negate_stmt} {DW_LNE_end_sequence} } } This new functionality will be used in a later commit. gdb/testsuite/ChangeLog: * lib/dwarf.exp (Dwarf::lines) Add support for modifying the is-stmt flag in the line table. Change-Id: Ia3f61d523826382dd2333f65b9aae368ad29c4a5 --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/lib/dwarf.exp | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 6c6ffbe7c2f..417b22d2345 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -1311,12 +1311,14 @@ namespace eval Dwarf { set _unit_addr_size default set _line_saw_program 0 set _line_saw_file 0 + set _default_is_stmt 1 foreach { name value } $options { switch -exact -- $name { is_64 { set is_64 $value } version { set _unit_version $value } addr_size { set _unit_addr_size $value } + default_is_stmt { set _default_is_stmt $value } default { error "unknown option $name" } } } @@ -1363,7 +1365,7 @@ namespace eval Dwarf { define_label $header_len_label _op .byte 1 "minimum_instruction_length" - _op .byte 1 "default_is_stmt" + _op .byte $_default_is_stmt "default_is_stmt" _op .byte 1 "line_base" _op .byte 1 "line_range" _op .byte 10 "opcode_base" @@ -1438,6 +1440,10 @@ namespace eval Dwarf { _op .byte 1 } + proc DW_LNS_negate_stmt {} { + _op .byte 6 + } + proc DW_LNS_advance_pc {offset} { _op .byte 2 _op .uleb128 ${offset}