Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH] [gdb/testsuite] Add gdb.base/include-main.exp
Date: Fri, 26 Nov 2021 11:20:16 -0500	[thread overview]
Message-ID: <af6bc4d0-6ba2-d298-320b-0a1a5fca4a45@simark.ca> (raw)
In-Reply-To: <20211126094852.32283-1-tdevries@suse.de>

On 2021-11-26 4:48 a.m., Tom de Vries via Gdb-patches wrote:
> The test-case gdb.ada/dgopt.exp uses the -gnatD switch, in combination with
> -gnatG.
>
> This causes the source file $src/gdb/testsuite/gdb.ada/dgopt/x.adb to be
> expanded into $build/gdb/testsuite/outputs/gdb.ada/dgopt/x.adb.dg, and the
> debug information should refer to the x.adb.dg file.
>
> That is the case for the .debug_line part:
> ...
> The Directory Table is empty.
>
>  The File Name Table (offset 0x1c):
>   Entry Dir     Time    Size    Name
>   1     0       0       0       x.adb.dg
> ...
> but not for the .debug_info part:
> ...
>     <11>   DW_AT_name        : $src/gdb/testsuite/gdb.ada/dgopt/x.adb
>     <15>   DW_AT_comp_dir    : $build/gdb/testsuite/outputs/gdb.ada/dgopt
> ...
>
> Filed as PR gcc/103436.
>
> In C we can generate similar debug information, using a source file that does
> not contain any code, but includes another one that does:
> ...
>  $ cat gdb/testsuite/gdb.base/include-main.c
>  #include "main.c"
> ...
> such that in the .debug_line part we have:
> ...
>  The Directory Table (offset 0x1c):
>   1     /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base
>
>  The File Name Table (offset 0x57):
>   Entry Dir     Time    Size    Name
>   1     1       0       0       main.c
> ...
> and in the .debug_info part:
> ...
>     <11>   DW_AT_name        : $src/gdb/testsuite/gdb.base/include-main.c
>     <15>   DW_AT_comp_dir    : $build/gdb/testsuite
> ...
>
> Add a C test-case that mimics gdb.ada/dgopt.exp, that is:
> - generate debug info as described above,
> - issue a list of a line in include-main.c, while the corresponding
>   CU is not expanded yet.
>
> Tested on x86_64-linux.
> ---
>  gdb/testsuite/gdb.base/include-main.c   | 18 ++++++++++
>  gdb/testsuite/gdb.base/include-main.exp | 47 +++++++++++++++++++++++++
>  gdb/testsuite/gdb.base/main.c           | 22 ++++++++++++

I'm not a fan of having a file with the generic name "main.c" there.
Could we name it something like "include-main-includee.c", without
affecting the intent of the test?

Simon


  reply	other threads:[~2021-11-26 16:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  9:48 Tom de Vries via Gdb-patches
2021-11-26 16:20 ` Simon Marchi [this message]
2021-11-26 17:11   ` Tom de Vries via Gdb-patches
2021-11-26 18:47     ` Simon Marchi
2021-11-27  0:59       ` Simon Marchi via Gdb-patches
2021-11-27  6:12         ` [committed][gdb/testsuite] Fix FAIL in gdb.base/list-missing-source.exp Tom de Vries via Gdb-patches
2021-11-30 20:39 ` [PATCH] [gdb/testsuite] Add gdb.base/include-main.exp Tom Tromey
2021-12-01  1:10   ` Tom Tromey
2021-12-01 14:58     ` Tom de Vries via Gdb-patches
2021-12-01 17:27       ` Tom Tromey
2021-12-02 12:59         ` Tom de Vries 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=af6bc4d0-6ba2-d298-320b-0a1a5fca4a45@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    --cc=tom@tromey.com \
    /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