aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2005-12-07 19:30:25 +0000
committerJim Blandy <jimb@codesourcery.com>2005-12-07 19:30:25 +0000
commit3d269a592e0d4dc94d69433bfbea85efef4951f4 (patch)
tree760932437754dc4928dd8d2e09b102b7c3a6e9a6 /gdb
parentf28760375823ffa73dc8db93c6abf9d2e3148981 (diff)
downloadgdb-3d269a592e0d4dc94d69433bfbea85efef4951f4.zip
gdb-3d269a592e0d4dc94d69433bfbea85efef4951f4.tar.gz
gdb-3d269a592e0d4dc94d69433bfbea85efef4951f4.tar.bz2
2005-12-07 Jim Blandy <jimb@redhat.com>
* ax-general.c (ax_reqs): Check stack heights for backward jumps, too. Correctly check height at target. Doc fixes.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ax-general.c32
2 files changed, 22 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 82a3a0d..3a4fcef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-07 Jim Blandy <jimb@redhat.com>
+
+ * ax-general.c (ax_reqs): Check stack heights for backward jumps,
+ too. Correctly check height at target. Doc fixes.
+
2005-12-06 Michael Snyder <msnyder@redhat.com>
* cli/cli-decode.c (add_setshow_string_cmd): Indent.
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index eb7a7ca..52fcfc8 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -388,15 +388,15 @@ ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs)
int reg_mask_len = 1;
unsigned char *reg_mask = xmalloc (reg_mask_len * sizeof (reg_mask[0]));
- /* Jump target table. targets[i] is non-zero iff there is a jump to
- offset i. */
+ /* Jump target table. targets[i] is non-zero iff we have found a
+ jump to offset i. */
char *targets = (char *) alloca (ax->len * sizeof (targets[0]));
- /* Instruction boundary table. boundary[i] is non-zero iff an
- instruction starts at offset i. */
+ /* Instruction boundary table. boundary[i] is non-zero iff our scan
+ has reached an instruction starting at offset i. */
char *boundary = (char *) alloca (ax->len * sizeof (boundary[0]));
- /* Stack height record. iff either targets[i] or boundary[i] is
+ /* Stack height record. If either targets[i] or boundary[i] is
non-zero, heights[i] is the height the stack should have before
executing the bytecode at that point. */
int *heights = (int *) alloca (ax->len * sizeof (heights[0]));
@@ -437,8 +437,9 @@ ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs)
return;
}
- /* If this instruction is a jump target, does the current stack
- height match the stack height at the jump source? */
+ /* If this instruction is a forward jump target, does the
+ current stack height match the stack height at the jump
+ source? */
if (targets[i] && (heights[i] != height))
{
reqs->flaw = agent_flaw_height_mismatch;
@@ -472,21 +473,22 @@ ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs)
xfree (reg_mask);
return;
}
- /* Have we already found other jumps to the same location? */
- else if (targets[target])
+
+ /* Do we have any information about what the stack height
+ should be at the target? */
+ if (targets[target] || boundary[target])
{
- if (heights[i] != height)
+ if (heights[target] != height)
{
reqs->flaw = agent_flaw_height_mismatch;
xfree (reg_mask);
return;
}
}
- else
- {
- targets[target] = 1;
- heights[target] = height;
- }
+
+ /* Record the target, along with the stack height we expect. */
+ targets[target] = 1;
+ heights[target] = height;
}
/* For unconditional jumps with a successor, check that the