summaryrefslogtreecommitdiff
path: root/gdb/gdbtk
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2001-05-11 14:33:10 +0000
committerKeith Seitz <keiths@redhat.com>2001-05-11 14:33:10 +0000
commitfd5c8e8d005eb8bd29764a9f4012450f06d1acde (patch)
tree7eb9662a04e20a12d8d9700e84c4a64b8d1dbdcc /gdb/gdbtk
parent1c045693941cf5618daa3ff26a628409e15b8dd9 (diff)
downloadgdb-fd5c8e8d005eb8bd29764a9f4012450f06d1acde.tar.gz
* generic/gdbtk-bp.c (gdbtk_create_breakpoint): Safe guard
against "invalid" (internal) breakpoint numbers. (gdbtk_modify_breakpoint): Ditto. (gdbtk_delete_breakpoint): Ditto.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r--gdb/gdbtk/ChangeLog7
-rw-r--r--gdb/gdbtk/generic/gdbtk-bp.c20
2 files changed, 24 insertions, 3 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index cf487fb6d42..8bbfd088088 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,3 +1,10 @@
+2001-05-11 Keith Seitz <keiths@cygnus.com>
+
+ * generic/gdbtk-bp.c (gdbtk_create_breakpoint): Safe guard
+ against "invalid" (internal) breakpoint numbers.
+ (gdbtk_modify_breakpoint): Ditto.
+ (gdbtk_delete_breakpoint): Ditto.
+
2001-05-10 Keith Seitz <keiths@cygnus.com>
* generic/gdbtk-bp.c (gdb_set_bp): Generate a breakpoint event
diff --git a/gdb/gdbtk/generic/gdbtk-bp.c b/gdb/gdbtk/generic/gdbtk-bp.c
index bab3ea4168c..79136a3e182 100644
--- a/gdb/gdbtk/generic/gdbtk-bp.c
+++ b/gdb/gdbtk/generic/gdbtk-bp.c
@@ -52,6 +52,15 @@ char *bptypes[] =
char *bpdisp[] =
{"delete", "delstop", "disable", "donttouch"};
+/* Is this breakpoint interesting to a user interface? */
+#define BREAKPOINT_IS_INTERESTING(bp) \
+((bp)->type == bp_breakpoint \
+ || (bp)->type == bp_hardware_breakpoint \
+ || (bp)->type == bp_watchpoint \
+ || (bp)->type == bp_hardware_watchpoint \
+ || (bp)->type == bp_read_watchpoint \
+ || (bp)->type == bp_access_watchpoint)
+
/*
* These are routines we need from breakpoint.c.
* at some point make these static in breakpoint.c and move GUI code there
@@ -575,7 +584,7 @@ gdbtk_create_breakpoint (int num)
break;
}
- if (b == NULL)
+ if (b == NULL || !BREAKPOINT_IS_INTERESTING (b))
return;
/* Check if there is room to store it */
@@ -595,7 +604,9 @@ gdbtk_create_breakpoint (int num)
void
gdbtk_delete_breakpoint (int num)
{
- if (breakpoint_list[num] != NULL)
+ if (num >= 0
+ && num <= breakpoint_list_size
+ && breakpoint_list[num] != NULL)
{
breakpoint_notify (num, "delete");
breakpoint_list[num] = NULL;
@@ -605,7 +616,8 @@ gdbtk_delete_breakpoint (int num)
void
gdbtk_modify_breakpoint (int num)
{
- breakpoint_notify (num, "modify");
+ if (num >= 0)
+ breakpoint_notify (num, "modify");
}
/* This is the generic function for handling changes in
@@ -622,7 +634,9 @@ breakpoint_notify (num, action)
char *buf;
if (num > breakpoint_list_size
+ || num < 0
|| breakpoint_list[num] == NULL
+ /* FIXME: should not be so restrictive... */
|| breakpoint_list[num]->type != bp_breakpoint)
return;