Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Zoran Zaric <Zoran.Zaric@amd.com>, gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 10/13] gdb/testsuite: add .debug_loclists tests
Date: Thu, 28 Jan 2021 12:47:59 -0500	[thread overview]
Message-ID: <56f87bf1-a43a-a710-005a-502101412d35@polymtl.ca> (raw)
In-Reply-To: <6fe96ff5-3f11-585c-0331-62d1fe234bd2@amd.com>

On 2021-01-28 11:52 a.m., Zoran Zaric wrote:>> From: Simon Marchi <simon.marchi@efficios.com>
>>
>> Add tests for the various issues fixed in the previous patches.
>>
>> Add a new "loclists" procedure to the DWARF assembler, to allow
>> generating .debug_loclists sections.
>>
> 
> Thank you for this contribution.
> 
> Having a loclists support in DWARF assembler gives us so considerable testing flexibility and decouples the gdb testing even more from what compiler is expected to generate.
> 
> The only thing missing now (at least in my mind) is the CFI support but that is a big project for the future.

Given that:

 - the actual assembler (GNU as or other) already has support for
   specifying and generating CFI, and
 - a test case that wants to use specific CFI would contain some
   assembly code already, to control exactly which instructions are
   generated

I don't think our assembler needs to know how to generate CFI, you'd
just write it in platform-specific assembly.

>> +
>> +    proc loclists { args } {
>> +       variable _debug_loclists_addr_size
>> +       variable _debug_loclists_offset_size
>> +       variable _debug_loclists_is_64_dwarf
>> +
>> +       parse_args {{"is-64" "false"}}
>> +
>> +       if { [llength $args] != 1 } {
>> +           error "loclists proc expects one positional argument (body)"
>> +       }
>> +
>> +       lassign $args body
>> +
>> +       if [is_64_target] {
>> +           set _debug_loclists_addr_size 8
>> +       } else {
>> +           set _debug_loclists_addr_size 4
>> +       }
>> +
>> +       if { ${is-64} } {
>> +           set _debug_loclists_offset_size 8
>> +           set _debug_loclists_is_64_dwarf true
>> +       } else {
>> +           set _debug_loclists_offset_size 4
>> +           set _debug_loclists_is_64_dwarf false
>> +       }
>> +
>> +       _section ".debug_loclists"
>> +
>> +       # Count of tables in the section.
>> +       variable _debug_loclists_table_count 0
>> +
>> +       # Compute the label name for list at index LIST_IDX, for the current
>> +       # table.
>> +
>> +       proc _compute_list_label { list_idx } {
>> +           variable _debug_loclists_table_count
>> +
>> +           return ".Lloclists_table_${_debug_loclists_table_count}_list_${list_idx}"
>> +       }
>> +
>> +       # Generate one table (header + offset array + location lists).
>> +       #
>> +       # Accepts one position argument, BODY.  BODY may call the LIST_
>> +       # procedure to generate loclists.
>> +       #
>> +       # The -post-header-label option can be used to define a label just after the
>> +       # header of the table.  This is the label that a DW_AT_loclists_base
>> +       # attribute will usually refer to.
>> +
>> +       proc table { args } {
>> +           variable _debug_loclists_table_count
>> +           variable _debug_loclists_addr_size
>> +           variable _debug_loclists_offset_size
>> +           variable _debug_loclists_is_64_dwarf
>> +
>> +           parse_args {{post-header-label ""}}
>> +
>> +           if { [llength $args] != 1 } {
>> +               error "table proc expects one positional argument (body)"
>> +           }
>> +
>> +           lassign $args body
>> +
>> +           # Generate one location list.
>> +           #
>> +           # BODY may call the various procs defined below to generate list
>> +           # entries.  They correspond to the location list entry kinds
>> +           # described in section 2.6.2 of the DWARF 5 spec.
>> +           #
>> +           # To define a label pointing to the beginning of the list, use
>> +           # the conventional way of declaring and defining labels:
>> +           #
>> +           #   declare_labels the_list
>> +           #
>> +           #   the_list: list_ {
>> +           #     ...
>> +           #   }
>> +
>> +           proc list_ { body } {
>> +               variable _debug_loclists_list_count
>> +
> 
> I guess that the table and list procedures from loclist and ranglist support couldn't be commonized in some way?
> 
> They do seem considerably different.

Yeah, they are similar (once you understand one, it's very easy to
understand the other).  But they are not identical.  So given that we
have only two kinds, I think it would just make it more complex for
nothing to try to factor out the common parts.  If we had 20 kinds, then
maybe it would be a different story :).

Simon

  reply	other threads:[~2021-01-28 17:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  5:39 [PATCH 00/13] DWARF 5 rnglists & loclists fixes (PR 26813) Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 01/13] gdb/dwarf: change read_loclist_index complaints into errors Simon Marchi via Gdb-patches
2021-01-28 15:17   ` Zoran Zaric via Gdb-patches
2021-01-28 15:42     ` Simon Marchi via Gdb-patches
2021-02-25 19:20       ` Tom Tromey
2021-01-20  5:39 ` [PATCH 02/13] gdb/dwarf: fix bound check in read_rnglist_index Simon Marchi via Gdb-patches
2021-01-28 15:22   ` Zoran Zaric via Gdb-patches
2021-01-20  5:39 ` [PATCH 03/13] gdb/dwarf: add missing bound check to read_loclist_index Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 04/13] gdb/dwarf: remove unnecessary check in read_{rng, loc}list_index Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 05/13] gdb/dwarf: few fixes for handling DW_FORM_{rng, loc}listx Simon Marchi via Gdb-patches
2021-01-28 15:30   ` [PATCH 05/13] gdb/dwarf: few fixes for handling DW_FORM_{rng,loc}listx Zoran Zaric via Gdb-patches
2021-01-20  5:39 ` [PATCH 06/13] gdb/dwarf: read correct rnglist/loclist header in read_{rng, loc}list_index Simon Marchi via Gdb-patches
2021-01-28 15:39   ` [PATCH 06/13] gdb/dwarf: read correct rnglist/loclist header in read_{rng,loc}list_index Zoran Zaric via Gdb-patches
2021-01-28 15:49     ` Simon Marchi via Gdb-patches
2021-01-28 15:54       ` Zoran Zaric via Gdb-patches
2021-01-20  5:39 ` [PATCH 07/13] gdb/dwarf: read DW_AT_ranges value as unsigned in partial_die_info::read Simon Marchi via Gdb-patches
2021-01-28 15:41   ` Zoran Zaric via Gdb-patches
2021-01-28 15:51     ` Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 08/13] gdb/testsuite: add .debug_rnglists tests Simon Marchi via Gdb-patches
2021-01-28 16:24   ` Zoran Zaric via Gdb-patches
2021-01-20  5:39 ` [PATCH 09/13] gdb/testsuite: DWARF assembler: add context parameters to _location Simon Marchi via Gdb-patches
2021-01-28 16:30   ` Zoran Zaric via Gdb-patches
2021-01-20  5:39 ` [PATCH 10/13] gdb/testsuite: add .debug_loclists tests Simon Marchi via Gdb-patches
2021-01-28 16:52   ` Zoran Zaric via Gdb-patches
2021-01-28 17:47     ` Simon Marchi via Gdb-patches [this message]
2021-01-29 10:13       ` Zoran Zaric via Gdb-patches
2021-01-29 15:57         ` Simon Marchi via Gdb-patches
2021-01-29 16:58           ` Zoran Zaric via Gdb-patches
2021-01-29 17:37             ` Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 11/13] gdb/dwarf: split dwarf2_cu::ranges_base in two Simon Marchi via Gdb-patches
2021-01-20  5:39 ` [PATCH 12/13] gdb/dwarf: make read_{loc, rng}list_index return sect_offset Simon Marchi via Gdb-patches
2021-02-25 19:26   ` Tom Tromey
2021-01-20  5:39 ` [PATCH 13/13] gdb/testsuite: add test for .debug_{rng, loc}lists section without offset array Simon Marchi via Gdb-patches
2021-02-02 15:43 ` [PATCH 00/13] DWARF 5 rnglists & loclists fixes (PR 26813) Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56f87bf1-a43a-a710-005a-502101412d35@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=Zoran.Zaric@amd.com \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox