aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2009-03-18 16:22:50 +0000
committerDoug Evans <dje@google.com>2009-03-18 16:22:50 +0000
commit36dc683c524086a6ed9b74375d6501a33e875182 (patch)
treeb25df6e91499eab6db09ec24733475abc5e399a5 /gdb/printcmd.c
parent4d40734860cc8faba65df788784d263810c57e4e (diff)
downloadgdb-36dc683c524086a6ed9b74375d6501a33e875182.zip
gdb-36dc683c524086a6ed9b74375d6501a33e875182.tar.gz
gdb-36dc683c524086a6ed9b74375d6501a33e875182.tar.bz2
* printcmd.c (display_uses_solib_p): Redo loop, scan element list
backwards.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 23a2230..5268b1d 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1763,18 +1763,23 @@ static int
display_uses_solib_p (const struct display *d,
const struct so_list *solib)
{
- int i;
+ int endpos;
struct expression *const exp = d->exp;
+ const union exp_element *const elts = exp->elts;
if (d->block != NULL
&& solib_contains_address_p (solib, d->block->startaddr))
return 1;
- for (i = 0; i < exp->nelts; )
+ for (endpos = exp->nelts; endpos > 0; )
{
- int args, oplen = 0;
- const union exp_element *const elts = exp->elts;
+ int i, args, oplen = 0;
+
+ exp->language_defn->la_exp_desc->operator_length (exp, endpos,
+ &oplen, &args);
+ gdb_assert (oplen > 0);
+ i = endpos - oplen;
if (elts[i].opcode == OP_VAR_VALUE)
{
const struct block *const block = elts[i + 1].block;
@@ -1789,11 +1794,9 @@ display_uses_solib_p (const struct display *d,
if (section && section->objfile == solib->objfile)
return 1;
}
- exp->language_defn->la_exp_desc->operator_length (exp, i + 1,
- &oplen, &args);
- gdb_assert (oplen > 0);
- i += oplen;
+ endpos -= oplen;
}
+
return 0;
}