public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments
@ 2014-04-30 22:13 jistone at redhat dot com
  2014-04-30 22:19 ` [Bug breakpoints/16889] " sergiodj at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jistone at redhat dot com @ 2014-04-30 22:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16889
           Summary: gdb segfaults when printing ASM SDT arguments
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: jistone at redhat dot com
                CC: sergiodj at redhat dot com

Created attachment 7571
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7571&action=edit
example x86_64 asm source with sdt probes

With a program compiled from the attached asm source, gdb is unable to print
the arguments, and actually segfaults on the second probe.

$ gcc -Wall probe.S -o probe
$ eu-readelf -n probe
[...]
Note section [28] '.note.stapsdt' of 128 bytes at offset 0x1058:
  Owner          Data size  Type
  stapsdt               41  Version: 3
    PC: 0x4004f5, Base: 0x400590, Semaphore: 0
    Provider: probe, Name: foo, Args: '(%rsp)'
  stapsdt               43  Version: 3
    PC: 0x4004f6, Base: 0x400590, Semaphore: 0
    Provider: probe, Name: bar, Args: '-8(%rbp)'
$ gdb ./probe
[...]
(gdb) b -p foo
Breakpoint 1 at 0x4004f5
(gdb) b -p bar
Breakpoint 2 at 0x4004f6
(gdb) r
Starting program: /home/jistone/test/probe 

Breakpoint 1, 0x00000000004004f5 in main ()
(gdb) p $_probe_arg0
Invalid probe argument 0 -- probe has 0 arguments available
(gdb) c
Continuing.

Breakpoint 2, 0x00000000004004f6 in main ()
(gdb) p $_probe_arg0
Segmentation fault


So probe 'foo' can't find the (%rsp) argument, but probe 'bar' just crashes.

If I add the optional N@ size, so they are "8@(%rsp)" and "8@-8(%rbp)", then
they are both fine.


I'm using gdb-7.6.50.20130731-19.fc20.x86_64

-- 
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 breakpoints/16889] gdb segfaults when printing ASM SDT arguments
  2014-04-30 22:13 [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments jistone at redhat dot com
@ 2014-04-30 22:19 ` sergiodj at redhat dot com
  2014-05-01 21:54 ` sergiodj at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sergiodj at redhat dot com @ 2014-04-30 22:19 UTC (permalink / raw)
  To: gdb-prs

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

Sergio Durigan Junior <sergiodj at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |sergiodj at redhat dot com

-- 
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 breakpoints/16889] gdb segfaults when printing ASM SDT arguments
  2014-04-30 22:13 [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments jistone at redhat dot com
  2014-04-30 22:19 ` [Bug breakpoints/16889] " sergiodj at redhat dot com
@ 2014-05-01 21:54 ` sergiodj at redhat dot com
  2014-05-02 20:53 ` cvs-commit at gcc dot gnu.org
  2014-05-02 20:55 ` sergiodj at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: sergiodj at redhat dot com @ 2014-05-01 21:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Sergio Durigan Junior <sergiodj at redhat dot com> ---
Proposed patch: https://sourceware.org/ml/gdb-patches/2014-05/msg00010.html

-- 
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 breakpoints/16889] gdb segfaults when printing ASM SDT arguments
  2014-04-30 22:13 [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments jistone at redhat dot com
  2014-04-30 22:19 ` [Bug breakpoints/16889] " sergiodj at redhat dot com
  2014-05-01 21:54 ` sergiodj at redhat dot com
@ 2014-05-02 20:53 ` cvs-commit at gcc dot gnu.org
  2014-05-02 20:55 ` sergiodj at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-05-02 20:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  30a1e6cc7750ce016ea70afa795c0764d07d21ae (commit)
       via  f33da99a5410692ddf1302435e27b1bfc21d0b11 (commit)
      from  54cb4522e7555fdf766201c3c74bfc8510c83424 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=30a1e6cc7750ce016ea70afa795c0764d07d21ae

commit 30a1e6cc7750ce016ea70afa795c0764d07d21ae
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri May 2 17:50:45 2014 -0300

    Extend recognized types of SDT probe's arguments

    This commit is actually an update to make the parser in
    gdb/stap-probe.c be aware of all the possible prefixes that a probe
    argument can have.  According to the section "Argument Format" in:

      <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

    The bitness of the arguments can be 8, 16, 32 or 64 bits, signed or
    unsigned.  Currently GDB recognizes only 32 and 64-bit arguments.
    This commit extends this.  It also provides a testcase, only for
    x86_64 systems.

    gdb/
    2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

        * stap-probe.c (enum stap_arg_bitness): New enums to represent 8
        and 16-bit signed and unsigned arguments.  Update comment.
        (stap_parse_probe_arguments): Extend code to handle such
        arguments.  Use warning instead of complaint to notify about
        unrecognized bitness.

    gdb/testsuite/
    2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

        * gdb.arch/amd64-stap-optional-prefix.S (main): Add several
        probes to test for bitness recognition.
        * gdb.arch/amd64-stap-optional-prefix.exp
        (test_probe_value_without_reg): New procedure.
        Add code to test for different kinds of bitness.

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

commit f33da99a5410692ddf1302435e27b1bfc21d0b11
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri May 2 17:45:35 2014 -0300

    Fix PR breakpoints/16889: gdb segfaults when printing  ASM SDT arguments

    This commit fixes PR breakpoints/16889, which is about a bug that
    triggers when GDB tries to parse probes whose arguments do not contain
    the initial (and optional) "N@" part.  For reference sake, the de
    facto format is described here:

      <https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation>

    Anyway, this PR actually uncovered two bugs (related) that were
    happening while parsing the arguments.  The first one was that the
    parser *was* catching *some* arguments that were missing the "N@"
    part, but it wasn't correctly setting the argument's type.  This was
    causing a NULL pointer being dereferenced, ouch...

    The second bug uncovered was that the parser was not catching all of
    the cases for a probe which did not provide the "N@" part.  The fix
    for that was to simplify the check that the code was making to
    identify non-prefixed probes.  The code is simpler and easier to read
    now.

    I am also providing a testcase for this bug, only for x86_64
    architectures.

    gdb/
    2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

        PR breakpoints/16889
        * stap-probe.c (stap_parse_probe_arguments): Simplify
        check for non-prefixed probes (i.e., probes whose
        arguments do not start with "N@").  Always set the
        argument type to a sane value.

    gdb/testsuite/
    2014-05-02  Sergio Durigan Junior  <sergiodj@redhat.com>

        PR breakpoints/16889
        * gdb.arch/amd64-stap-optional-prefix.S: New file.
        * gdb.arch/amd64-stap-optional-prefix.exp: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                                      |   16 ++++
 gdb/stap-probe.c                                   |   76 ++++++++++++----
 gdb/testsuite/ChangeLog                            |   14 +++
 .../gdb.arch/amd64-stap-optional-prefix.S          |   42 +++++++++
 .../gdb.arch/amd64-stap-optional-prefix.exp        |   91 ++++++++++++++++++++
 5 files changed, 220 insertions(+), 19 deletions(-)
 create mode 100644 gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S
 create mode 100644 gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp

-- 
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 breakpoints/16889] gdb segfaults when printing ASM SDT arguments
  2014-04-30 22:13 [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments jistone at redhat dot com
                   ` (2 preceding siblings ...)
  2014-05-02 20:53 ` cvs-commit at gcc dot gnu.org
@ 2014-05-02 20:55 ` sergiodj at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: sergiodj at redhat dot com @ 2014-05-02 20:55 UTC (permalink / raw)
  To: gdb-prs

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

Sergio Durigan Junior <sergiodj at redhat dot com> changed:

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

--- Comment #3 from Sergio Durigan Junior <sergiodj at redhat dot com> ---
Fixed.

-- 
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:[~2014-05-02 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 22:13 [Bug breakpoints/16889] New: gdb segfaults when printing ASM SDT arguments jistone at redhat dot com
2014-04-30 22:19 ` [Bug breakpoints/16889] " sergiodj at redhat dot com
2014-05-01 21:54 ` sergiodj at redhat dot com
2014-05-02 20:53 ` cvs-commit at gcc dot gnu.org
2014-05-02 20:55 ` sergiodj at redhat dot com

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).