diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-06-22 13:03:40 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-06-22 13:03:40 +0000 |
commit | 911b23336b9915405797925025033429a9d458ff (patch) | |
tree | ca5b16dd87adb6be17952a99f3ef9cce1d97a7fa /sim/ppc/emul_chirp.c | |
parent | b4177fca1357236a635e37a18c2e143e3eadbede (diff) | |
download | gdb-911b23336b9915405797925025033429a9d458ff.zip gdb-911b23336b9915405797925025033429a9d458ff.tar.gz gdb-911b23336b9915405797925025033429a9d458ff.tar.bz2 |
2003-06-22 Andrew Cagney <cagney@redhat.com>
Problems reported by Joshua LeVasseur.
* emul_chirp.c: Update copyright.
(chirp_emul_nextprop): Return the first property.
* hw_htab.c: Update copyright.
(htab_decode_hash_table): Fix check for htab size.
Diffstat (limited to 'sim/ppc/emul_chirp.c')
-rw-r--r-- | sim/ppc/emul_chirp.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/sim/ppc/emul_chirp.c b/sim/ppc/emul_chirp.c index c4deb18..976f766 100644 --- a/sim/ppc/emul_chirp.c +++ b/sim/ppc/emul_chirp.c @@ -1,6 +1,6 @@ /* This file is part of the program psim. - Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au> + Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -584,10 +584,15 @@ chirp_emul_nextprop(os_emul_data *data, if (chirp_read_t2h_args(&args, sizeof(args), 3, 1, data, processor, cia)) return -1; phandle = external_to_device(data->root, args.phandle); - emul_read_string(previous, - args.previous, - sizeof(previous), - processor, cia); + if (args.previous != 0) + emul_read_string(previous, + args.previous, + sizeof(previous), + processor, cia); + else + /* If previous is NULL, make it look like the empty string. The + next property after the empty string is the first property. */ + strcpy (previous, ""); TRACE(trace_os_emul, ("nextprop - in - phandle=0x%lx(0x%lx`%s') previous=`%s' buf=0x%lx\n", (unsigned long)args.phandle, (unsigned long)phandle, @@ -602,11 +607,19 @@ chirp_emul_nextprop(os_emul_data *data, else { const device_property *prev_prop = device_find_property(phandle, previous); if (prev_prop == NULL) { - args.flag = -1; /* name invalid */ + if (strcmp (previous, "") == 0) + args.flag = 0; /* No properties */ + else + args.flag = -1; /* name invalid */ } else { const device_property *next_prop; - next_prop = device_next_property(prev_prop); + if (strcmp (previous, "") == 0) { + next_prop = prev_prop; /* The first property. */ + } + else { + next_prop = device_next_property(prev_prop); + } if (next_prop == NULL) { args.flag = 0; /* last property */ } |