public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/112768] New: btf: fix asm comment output for BTF_KIND_FUNC* kinds
@ 2023-11-29 19:18 ibhagat at gcc dot gnu.org
  2023-11-29 19:20 ` [Bug debug/112768] " ibhagat at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ibhagat at gcc dot gnu.org @ 2023-11-29 19:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112768

            Bug ID: 112768
           Summary: btf: fix asm comment output for BTF_KIND_FUNC* kinds
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ibhagat at gcc dot gnu.org
  Target Milestone: ---

The BTF type of kind BTF_KIND_FUNC_PROTO is always anonymous.  The
machinery, via btf_collect_datasec (), resets the ctti_name to 0 to
reflect that.  The name string in the (ctf) type contained in the CTF
container is, however, not updated.  The latter is used to emit the type
name in the asm comment output.

E.g., for gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c:

extern int extfunc(int a, int b);

int foo (int x) {

  int y = extfunc (x, x+1);

  return y;
}

a user may see the following in the comments in the -dA output:

    .long   0       # TYPE 2 BTF_KIND_FUNC_PROTO 'extfunc'
    .long   0xd000002       # btt_info: kind=13, kflag=0, vlen=2
    .long   0x1     # btt_type: (BTF_KIND_INT 'int')
    .long   0       # farg_name
    .long   0x1     # farg_type: (BTF_KIND_INT 'int')
    .long   0       # farg_name
    .long   0x1     # farg_type: (BTF_KIND_INT 'int')
    .long   0       # TYPE 3 BTF_KIND_FUNC_PROTO 'foo'
    .long   0xd000001       # btt_info: kind=13, kflag=0, vlen=1
    .long   0x1     # btt_type: (BTF_KIND_INT 'int')
    .long   0x68    # farg_name
    .long   0x1     # farg_type: (BTF_KIND_INT 'int')
    .long   0x5     # TYPE 4 BTF_KIND_FUNC '(null)'
    .long   0xc000002       # btt_info: kind=12, kflag=0, linkage=2
    .long   0x2     # btt_type: (BTF_KIND_FUNC_PROTO 'extfunc')
    .long   0xd     # TYPE 5 BTF_KIND_FUNC '(null)'
    .long   0xc000001       # btt_info: kind=12, kflag=0, linkage=1
    .long   0x3     # btt_type: (BTF_KIND_FUNC_PROTO 'foo')

The above may cause confusion to the reader:
- Types of kind BTF_KIND_FUNC_PROTO are displayed with a name.
- BTF_KIND_FUNC appears with 'null'

It will be ideal to display:
- BTF_KIND_FUNC_PROTO as anonymous
- BTF_KIND_FUNC with the name of the function

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

* [Bug debug/112768] btf: fix asm comment output for BTF_KIND_FUNC* kinds
  2023-11-29 19:18 [Bug debug/112768] New: btf: fix asm comment output for BTF_KIND_FUNC* kinds ibhagat at gcc dot gnu.org
@ 2023-11-29 19:20 ` ibhagat at gcc dot gnu.org
  2023-12-04 10:01 ` cvs-commit at gcc dot gnu.org
  2024-03-02  0:28 ` ibhagat at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ibhagat at gcc dot gnu.org @ 2023-11-29 19:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112768

Indu Bhagat <ibhagat at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug debug/112768] btf: fix asm comment output for BTF_KIND_FUNC* kinds
  2023-11-29 19:18 [Bug debug/112768] New: btf: fix asm comment output for BTF_KIND_FUNC* kinds ibhagat at gcc dot gnu.org
  2023-11-29 19:20 ` [Bug debug/112768] " ibhagat at gcc dot gnu.org
@ 2023-12-04 10:01 ` cvs-commit at gcc dot gnu.org
  2024-03-02  0:28 ` ibhagat at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-04 10:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112768

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Indu Bhagat <ibhagat@gcc.gnu.org>:

https://gcc.gnu.org/g:9b6e2cb7e61ebb7006a89fa75869ec1a3e0a6e33

commit r14-6111-g9b6e2cb7e61ebb7006a89fa75869ec1a3e0a6e33
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Mon Dec 4 01:57:25 2023 -0800

    BTF: fix PR debug/112768

    PR debug/112768 - btf: fix asm comment output for BTF_KIND_FUNC* kinds

    The patch adds a small function to abstract out the detail and return
    the name of the type.  The patch also fixes the issue of BTF_KIND_FUNC
    appearing in the comments with a 'null' string.

    For btf-function-6.c testcase, after the patch:

            .long   0       # TYPE 2 BTF_KIND_FUNC_PROTO ''
            .long   0xd000002       # btt_info: kind=13, kflag=0, vlen=2
            .long   0x1     # btt_type: (BTF_KIND_INT 'int')
            .long   0       # farg_name
            .long   0x1     # farg_type: (BTF_KIND_INT 'int')
            .long   0       # farg_name
            .long   0x1     # farg_type: (BTF_KIND_INT 'int')
            .long   0       # TYPE 3 BTF_KIND_FUNC_PROTO ''
            .long   0xd000001       # btt_info: kind=13, kflag=0, vlen=1
            .long   0x1     # btt_type: (BTF_KIND_INT 'int')
            .long   0x68    # farg_name
            .long   0x1     # farg_type: (BTF_KIND_INT 'int')
            .long   0x5     # TYPE 4 BTF_KIND_FUNC 'extfunc'
            .long   0xc000002       # btt_info: kind=12, kflag=0, linkage=2
            .long   0x2     # btt_type: (BTF_KIND_FUNC_PROTO '')
            .long   0xd     # TYPE 5 BTF_KIND_FUNC 'foo'
            .long   0xc000001       # btt_info: kind=12, kflag=0, linkage=1
            .long   0x3     # btt_type: (BTF_KIND_FUNC_PROTO '')

    gcc/ChangeLog:

            PR debug/112768
            * btfout.cc (get_btf_type_name): New definition.
            (btf_collect_datasec): Update dtd_name to the original type name
            string.
            (btf_asm_type_ref): Use the new get_btf_type_name function
            instead.
            (btf_asm_type): Likewise.
            (btf_asm_func_type): Likewise.

    gcc/testsuite/ChangeLog:

            PR debug/112768
            * gcc.dg/debug/btf/btf-function-6.c: Empty string expected with
            BTF_KIND_FUNC_PROTO.

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

* [Bug debug/112768] btf: fix asm comment output for BTF_KIND_FUNC* kinds
  2023-11-29 19:18 [Bug debug/112768] New: btf: fix asm comment output for BTF_KIND_FUNC* kinds ibhagat at gcc dot gnu.org
  2023-11-29 19:20 ` [Bug debug/112768] " ibhagat at gcc dot gnu.org
  2023-12-04 10:01 ` cvs-commit at gcc dot gnu.org
@ 2024-03-02  0:28 ` ibhagat at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ibhagat at gcc dot gnu.org @ 2024-03-02  0:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112768

Indu Bhagat <ibhagat at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Indu Bhagat <ibhagat at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2024-03-02  0:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 19:18 [Bug debug/112768] New: btf: fix asm comment output for BTF_KIND_FUNC* kinds ibhagat at gcc dot gnu.org
2023-11-29 19:20 ` [Bug debug/112768] " ibhagat at gcc dot gnu.org
2023-12-04 10:01 ` cvs-commit at gcc dot gnu.org
2024-03-02  0:28 ` ibhagat at gcc dot gnu.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).