public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/28359] New: ptype/o does not show offset if the current language is asm
@ 2021-09-21  9:08 fweimer at redhat dot com
  2022-11-07 17:08 ` [Bug exp/28359] " tromey at sourceware dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2021-09-21  9:08 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28359
           Summary: ptype/o does not show offset if the current language
                    is asm
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---

Reproducer:

$ gdb /lib64/libc.so.6
[…]
Reading symbols from /lib64/libc.so.6...
Reading symbols from
/usr/lib/debug/usr/lib64/libc-2.32.so-2.32-10.fc33.x86_64.debug...
(gdb) set language asm
(gdb) ptype/o struct _IO_FILE
type = struct _IO_FILE {
    int _flags;
    char *_IO_read_ptr;
    char *_IO_read_end;
    char *_IO_read_base;
    char *_IO_write_base;
    char *_IO_write_ptr;
    char *_IO_write_end;
    char *_IO_buf_base;
    char *_IO_buf_end;
    char *_IO_save_base;
    char *_IO_backup_base;
    char *_IO_save_end;
    _IO_marker *_markers;
    _IO_FILE *_chain;
    int _fileno;
    int _flags2;
    __off_t _old_offset;
    unsigned short _cur_column;
    signed char _vtable_offset;
    char _shortbuf[1];
    _IO_lock_t *_lock;
    __off64_t _offset;
    _IO_codecvt *_codecvt;
    _IO_wide_data *_wide_data;
    _IO_FILE *_freeres_list;
    void *_freeres_buf;
    size_t __pad5;
    int _mode;
    char _unused2[20];
}

If GDB can find the type, it should be able to figure out the proper language
as well. Using the current language for determining type layout seems wrong.

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

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

* [Bug exp/28359] ptype/o does not show offset if the current language is asm
  2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
@ 2022-11-07 17:08 ` tromey at sourceware dot org
  2022-11-07 21:00 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2022-11-07 17:08 UTC (permalink / raw)
  To: gdb-prs

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

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> ---
There's a hard-coded check in typeprint.c:

                    /* Filter out languages which don't implement the
                       feature.  */
                    if (show > 0
                        && (current_language->la_language == language_c
                            || current_language->la_language == language_cplus
                            || current_language->la_language == language_rust))


... which seems pretty lame.
Better would be for languages to reset this themselves;
then 'asm' would work because it is basically just C anyway.

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

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

* [Bug exp/28359] ptype/o does not show offset if the current language is asm
  2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
  2022-11-07 17:08 ` [Bug exp/28359] " tromey at sourceware dot org
@ 2022-11-07 21:00 ` tromey at sourceware dot org
  2022-11-08 20:17 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2022-11-07 21:00 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch, ended up taking a different route from
what I proposed.

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

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

* [Bug exp/28359] ptype/o does not show offset if the current language is asm
  2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
  2022-11-07 17:08 ` [Bug exp/28359] " tromey at sourceware dot org
  2022-11-07 21:00 ` tromey at sourceware dot org
@ 2022-11-08 20:17 ` tromey at sourceware dot org
  2022-11-09 15:40 ` cvs-commit at gcc dot gnu.org
  2022-11-09 16:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2022-11-08 20:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2022-November/193604.html

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

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

* [Bug exp/28359] ptype/o does not show offset if the current language is asm
  2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
                   ` (2 preceding siblings ...)
  2022-11-08 20:17 ` tromey at sourceware dot org
@ 2022-11-09 15:40 ` cvs-commit at gcc dot gnu.org
  2022-11-09 16:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-09 15:40 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=97e20099d3b02baafe244e975aebe09020d2ab34

commit 97e20099d3b02baafe244e975aebe09020d2ab34
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Nov 7 11:12:35 2022 -0700

    Allow 'ptype/o' for assembly

    PR exp/28359 points out that 'ptype/o' does not work when the current
    language is "asm".

    I tracked this down to a hard-coded list of languages in typeprint.c.
    This patch replaces this list with a method on 'language_defn'
    instead.  If all languages are ever updated to have this feature, the
    method could be removed; but in the meantime this lets each language
    control what happens.

    I looked at having each print_type method simply modify the flags
    itself, but this doesn't work very well with the feature that disables
    method-printing by default (but allows it via a flag).

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28359
    Approved-By: Andrew Burgess <aburgess@redhat.com>
    Approved-By: Keith Seitz <keiths@redhat.com>

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

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

* [Bug exp/28359] ptype/o does not show offset if the current language is asm
  2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
                   ` (3 preceding siblings ...)
  2022-11-09 15:40 ` cvs-commit at gcc dot gnu.org
@ 2022-11-09 16:07 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2022-11-09 16:07 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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

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

end of thread, other threads:[~2022-11-09 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21  9:08 [Bug exp/28359] New: ptype/o does not show offset if the current language is asm fweimer at redhat dot com
2022-11-07 17:08 ` [Bug exp/28359] " tromey at sourceware dot org
2022-11-07 21:00 ` tromey at sourceware dot org
2022-11-08 20:17 ` tromey at sourceware dot org
2022-11-09 15:40 ` cvs-commit at gcc dot gnu.org
2022-11-09 16:07 ` 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).