public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26644] New: `info variables` does not show ones defined with macro
@ 2020-09-22 10:21 hi-angel at yandex dot ru
  2020-09-22 10:22 ` [Bug gdb/26644] `info variables` does not show ones defined with #define hi-angel at yandex dot ru
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hi-angel at yandex dot ru @ 2020-09-22 10:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26644

            Bug ID: 26644
           Summary: `info variables` does not show ones defined with macro
           Product: gdb
           Version: 9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hi-angel at yandex dot ru
  Target Milestone: ---

Currently `info variables` command does not print ones declared with `#define`.
I mean, it kinda makes sense if you take the meaning of "variable" as of a
mutable identifier. However this is not the meaning gdb uses because the
command prints enum fields just fine, which are not mutable either. So this is
a bug.

# Steps to reproduce (in terms of terminal commands)

    $ cat test2.c
    #define MY_MACRO 7

    int main() {}
    $ gcc test2.c -o a -g3 -O0
    $ gdb ./a
    Reading symbols from ./a...
    gdb λ br main
    Breakpoint 1 at 0x1122: file test2.c, line 3.
    gdb λ r
    Starting program: /tmp/a

    Breakpoint 1, main () at test2.c:3
    3       int main() {}
    gdb λ p MY_MACRO
    $1 = 7
    gdb λ info variables MY_MACRO
    All variables matching regular expression "MY_MACRO":
    gdb λ

## Expected

`info variables` would print `#define MY_MACRO 7`

## Actual

`info variables` did not print anything about MY_MACRO.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/26644] `info variables` does not show ones defined with #define
  2020-09-22 10:21 [Bug gdb/26644] New: `info variables` does not show ones defined with macro hi-angel at yandex dot ru
@ 2020-09-22 10:22 ` hi-angel at yandex dot ru
  2020-09-23 19:51 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hi-angel at yandex dot ru @ 2020-09-22 10:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26644

Hi-Angel <hi-angel at yandex dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|`info variables` does not   |`info variables` does not
                   |show ones defined with      |show ones defined with
                   |macro                       |#define

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/26644] `info variables` does not show ones defined with #define
  2020-09-22 10:21 [Bug gdb/26644] New: `info variables` does not show ones defined with macro hi-angel at yandex dot ru
  2020-09-22 10:22 ` [Bug gdb/26644] `info variables` does not show ones defined with #define hi-angel at yandex dot ru
@ 2020-09-23 19:51 ` tromey at sourceware dot org
  2020-09-23 21:32 ` hi-angel at yandex dot ru
  2020-09-24 12:35 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2020-09-23 19:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26644

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
gdb will show this with "info macro".
Macros aren't really variables, and often there are many
more in scope than you might think -- enough that they
would overwhelm the output relating to real variables,
which is probably what most users want.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/26644] `info variables` does not show ones defined with #define
  2020-09-22 10:21 [Bug gdb/26644] New: `info variables` does not show ones defined with macro hi-angel at yandex dot ru
  2020-09-22 10:22 ` [Bug gdb/26644] `info variables` does not show ones defined with #define hi-angel at yandex dot ru
  2020-09-23 19:51 ` tromey at sourceware dot org
@ 2020-09-23 21:32 ` hi-angel at yandex dot ru
  2020-09-24 12:35 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: hi-angel at yandex dot ru @ 2020-09-23 21:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26644

--- Comment #2 from Hi-Angel <hi-angel at yandex dot ru> ---
(In reply to Tom Tromey from comment #1)
> gdb will show this with "info macro".  Macros aren't really variables

You probably imply that macros can accept arguments, which makes them not to be
variables. Well… probably that's fair too. Feel free to close report if you
don't
think it's actionable.

>, and often there are many more in scope than you might think -- enough that
> they would overwhelm the output relating to real variables, which is probably
> what most users want.

I don't think such problem is a thing. If you execute `info variables` with the
original
testcase which does not even contain includes, you will get so overwhelming
amount of output that terminal scrollback won't have enough space. That's why
`i
variables` supports regexps, to reduce the output.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/26644] `info variables` does not show ones defined with #define
  2020-09-22 10:21 [Bug gdb/26644] New: `info variables` does not show ones defined with macro hi-angel at yandex dot ru
                   ` (2 preceding siblings ...)
  2020-09-23 21:32 ` hi-angel at yandex dot ru
@ 2020-09-24 12:35 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2020-09-24 12:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26644

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Hi-Angel from comment #2)
> (In reply to Tom Tromey from comment #1)
> > gdb will show this with "info macro".  Macros aren't really variables
> 
> You probably imply that macros can accept arguments, which makes them not to
> be
> variables.

They also have different scoping and can expand to anything,
which isn't actually all that uncommon.

> I don't think such problem is a thing. If you execute `info variables` with
> the original
> testcase which does not even contain includes, you will get so overwhelming
> amount of output that terminal scrollback won't have enough space.

Try it on a real program, like say any random function in gdb itself,
and you'll see what I mean.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-24 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 10:21 [Bug gdb/26644] New: `info variables` does not show ones defined with macro hi-angel at yandex dot ru
2020-09-22 10:22 ` [Bug gdb/26644] `info variables` does not show ones defined with #define hi-angel at yandex dot ru
2020-09-23 19:51 ` tromey at sourceware dot org
2020-09-23 21:32 ` hi-angel at yandex dot ru
2020-09-24 12:35 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).