more 8+3 friendly. gdb/ * Makefile.in (py-cmd.o): Renamed from python-cmd.o. Updated references. (py-frame.o): Renamed from python-frame.o. Updated references. (py-function.o): Renamed from python-function.o. Updated references. (py-objfile.o): Renamed from python-objfile.o. Updated references. (py-prettyprint.o): Renamed from python-prettyprint.o. Updated +references. (py-type.o): Renamed from python-type.o. Updated references. (py-utils.o): Renamed from python-utils.o. Updated references. (py-value.o): Renamed from python-value.o. Updated references. * py-cmd.o: Renamed from python-cmd.o. * py-frame.o: Renamed from python-frame.o. * py-function.o: Renamed from python-function.o. * py-objfile.o: Renamed from python-objfile.o. * py-prettyprint.o: Renamed from python-prettyprint.o. * py-type.o: Renamed from python-type.o. * py-utils.o: Renamed from python-utils.o. * py-value.o: Renamed from python-value.o. gdb/testsuite/ * gdb.python/Makefile.in (EXECUTABLES): Adjust to new executable names, add missing ones. * gdb.python/py-cmd.exp: Rename from python-cmd.exp. * gdb.python/py-frame.c: Rename from python-frame.c. * gdb.python/py-frame.exp: Rename from python-frame.exp. Adjust testfile name. * gdb.python/py-function.exp: Rename from python-function.exp. * gdb.python/py-mi.exp: Rename from python-mi.exp. Adjust testfile name. * gdb.python/py-prettyprint.c: Rename from python-prettyprint.c. * gdb.python/py-prettyprint.exp: Rename from python-prettyprint.exp. Adjust testfile name. * gdb.python/py-prettyprint.py: Rename from python-prettyprint.py. * gdb.python/py-template.cc: Rename from python-template.cc. * gdb.python/py-template.exp: Rename from python-template.exp. Adjust testfile name. * gdb.python/py-value.c: Rename from python-value.c. * gdb.python/py-value.exp: Rename from python-value.exp. Adjust testfile name.
201 lines
3.1 KiB
C
201 lines
3.1 KiB
C
/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
Copyright 2008, 2009 Free Software Foundation, Inc.
|
|
|
|
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
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
struct s
|
|
{
|
|
int a;
|
|
int *b;
|
|
};
|
|
|
|
struct ss
|
|
{
|
|
struct s a;
|
|
struct s b;
|
|
};
|
|
|
|
struct ns {
|
|
const char *null_str;
|
|
int length;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
struct S : public s {
|
|
int zs;
|
|
};
|
|
|
|
struct SS {
|
|
int zss;
|
|
S s;
|
|
};
|
|
|
|
struct SSS
|
|
{
|
|
SSS (int x, const S& r);
|
|
int a;
|
|
const S &b;
|
|
};
|
|
SSS::SSS (int x, const S& r) : a(x), b(r) { }
|
|
|
|
class VirtualTest
|
|
{
|
|
private:
|
|
int value;
|
|
|
|
public:
|
|
VirtualTest ()
|
|
{
|
|
value = 1;
|
|
}
|
|
};
|
|
|
|
class Vbase1 : public virtual VirtualTest { };
|
|
class Vbase2 : public virtual VirtualTest { };
|
|
class Vbase3 : public virtual VirtualTest { };
|
|
|
|
class Derived : public Vbase1, public Vbase2, public Vbase3
|
|
{
|
|
private:
|
|
int value;
|
|
|
|
public:
|
|
Derived ()
|
|
{
|
|
value = 2;
|
|
}
|
|
};
|
|
|
|
#endif
|
|
|
|
typedef struct string_repr
|
|
{
|
|
struct whybother
|
|
{
|
|
const char *contents;
|
|
} whybother;
|
|
} string;
|
|
|
|
/* This lets us avoid malloc. */
|
|
int array[100];
|
|
|
|
struct container
|
|
{
|
|
string name;
|
|
int len;
|
|
int *elements;
|
|
};
|
|
|
|
typedef struct container zzz_type;
|
|
|
|
string
|
|
make_string (const char *s)
|
|
{
|
|
string result;
|
|
result.whybother.contents = s;
|
|
return result;
|
|
}
|
|
|
|
zzz_type
|
|
make_container (const char *s)
|
|
{
|
|
zzz_type result;
|
|
|
|
result.name = make_string (s);
|
|
result.len = 0;
|
|
result.elements = 0;
|
|
|
|
return result;
|
|
}
|
|
|
|
void
|
|
add_item (zzz_type *c, int val)
|
|
{
|
|
if (c->len == 0)
|
|
c->elements = array;
|
|
c->elements[c->len] = val;
|
|
++c->len;
|
|
}
|
|
|
|
void init_s(struct s *s, int a)
|
|
{
|
|
s->a = a;
|
|
s->b = &s->a;
|
|
}
|
|
|
|
void init_ss(struct ss *s, int a, int b)
|
|
{
|
|
init_s(&s->a, a);
|
|
init_s(&s->b, b);
|
|
}
|
|
|
|
void do_nothing(void)
|
|
{
|
|
int c;
|
|
|
|
c = 23; /* Another MI breakpoint */
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
struct ss ss;
|
|
struct ss ssa[2];
|
|
string x = make_string ("this is x");
|
|
zzz_type c = make_container ("container");
|
|
const struct string_repr cstring = { { "const string" } };
|
|
|
|
init_ss(&ss, 1, 2);
|
|
init_ss(ssa+0, 3, 4);
|
|
init_ss(ssa+1, 5, 6);
|
|
|
|
struct ns ns;
|
|
ns.null_str = "embedded\0null\0string";
|
|
ns.length = 20;
|
|
|
|
#ifdef __cplusplus
|
|
S cps;
|
|
|
|
cps.zs = 7;
|
|
init_s(&cps, 8);
|
|
|
|
SS cpss;
|
|
cpss.zss = 9;
|
|
init_s(&cpss.s, 10);
|
|
|
|
SS cpssa[2];
|
|
cpssa[0].zss = 11;
|
|
init_s(&cpssa[0].s, 12);
|
|
cpssa[1].zss = 13;
|
|
init_s(&cpssa[1].s, 14);
|
|
|
|
SSS sss(15, cps);
|
|
|
|
SSS& ref (sss);
|
|
|
|
Derived derived;
|
|
|
|
#endif
|
|
|
|
add_item (&c, 23); /* MI breakpoint here */
|
|
add_item (&c, 72);
|
|
|
|
#ifdef MI
|
|
do_nothing ();
|
|
#endif
|
|
|
|
return 0; /* break to inspect struct and union */
|
|
}
|