Bug 17023 - gdbserver crash inserting breakpoint on LynxOS
Summary: gdbserver crash inserting breakpoint on LynxOS
Alias: None
Product: gdb
Classification: Unclassified
Component: server (show other bugs)
Version: HEAD
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2014-06-04 18:00 UTC by Joel Brobecker
Modified: 2014-06-04 22:09 UTC (History)
0 users

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Joel Brobecker 2014-06-04 18:00:59 UTC
Debugging a program on LynxOS via GDBserver, inserting a breakpoint and resuming the program's execution causes GDBserver to crash while processing the Z0 packet.

The crash appears in...

static int
z_type_supported (char z_type)
  return (z_type >= '0' && z_type <= '4'
          && the_target->supports_z_point_type (z_type));

... because the_target->supports_z_point_type is not set (NULL) for this target. Same for SPU, so chances are this target is also affected.

I will send a proposed fix to gdb-patches as soon as testing finishes.
Comment 1 cvs-commit@gcc.gnu.org 2014-06-04 21:58:19 UTC
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  ef7cab6ba16d76c3470fb27a0c8966513f7cb34a (commit)
      from  012370f6818657a816df1463ee71ca4e4ee40b33 (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 -----------------------------------------------------------------

commit ef7cab6ba16d76c3470fb27a0c8966513f7cb34a
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Wed Jun 4 14:03:22 2014 -0400

    gdbserver crash if the_target->supports_z_point_type is NULL
    When debugging on LynxOS targets (and probably on SPU targets as well),
    inserting a breakpoint and resuming the program's execution causes
    GDBserver to crash.
    The crash occurs while handling the Z0 packet sent by GDB to insert
    our breakpoint, because z_type_supported calls
    the_target->supports_z_point_type without checking that it is not NULL
    This patch fixes the issue by making z_type_supported return false if
    the_target->supports_z_point_type is NULL.
            PR server/17023
            * mem-break.c (z_type_supported): Return zero if
    Tested on ppx-lynx5.


Summary of changes:
 gdb/ChangeLog             |    6 ++++++
 gdb/gdbserver/mem-break.c |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)
Comment 2 Joel Brobecker 2014-06-04 22:09:41 UTC
Fixed by commit in comment #1.