mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 10:34:21 +08:00
2008-10-03 Paul Pluzhnikov <ppluzhnikov@google.com>
PR gdb/2384: * gdb.cp/gdb2384.exp: Extended to test more cases. * gdb.cp/gdb2384.cc: Likewise. * gdb.cp/gdb2384-base.h: Likewise. * gdb.cp/gdb2384-base.cc: Likewise.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2008-10-03 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||||
|
|
||||||
|
PR gdb/2384:
|
||||||
|
* gdb.cp/gdb2384.exp: Extended to test more cases.
|
||||||
|
* gdb.cp/gdb2384.cc: Likewise.
|
||||||
|
* gdb.cp/gdb2384-base.h: Likewise.
|
||||||
|
* gdb.cp/gdb2384-base.cc: Likewise.
|
||||||
|
|
||||||
2008-10-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2008-10-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
* gdb.base/maint.exp (maint print type): Remove printing
|
* gdb.base/maint.exp (maint print type): Remove printing
|
||||||
|
@ -28,3 +28,8 @@ base::meth ()
|
|||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
derived::derived (int _x)
|
||||||
|
: base (_x)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -23,3 +23,9 @@ class base
|
|||||||
int x;
|
int x;
|
||||||
virtual int meth ();
|
virtual int meth ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class derived : public base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
derived (int _x);
|
||||||
|
};
|
||||||
|
@ -18,23 +18,36 @@
|
|||||||
|
|
||||||
#include "gdb2384-base.h"
|
#include "gdb2384-base.h"
|
||||||
|
|
||||||
class derived : public base
|
class derived1 : public base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
derived (int);
|
derived1 (int);
|
||||||
};
|
};
|
||||||
|
|
||||||
derived::derived (int _x)
|
derived1::derived1 (int _x)
|
||||||
: base (_x)
|
: base (_x)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class derived2 : public derived
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
derived2 (int);
|
||||||
|
};
|
||||||
|
|
||||||
|
derived2::derived2 (int _x)
|
||||||
|
: derived (_x)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int g;
|
int g;
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
derived d (42);
|
derived1 d1 (42);
|
||||||
g = d.meth (); // set breakpoint here
|
derived2 d2 (24);
|
||||||
|
g = d1.meth (); // set breakpoint here
|
||||||
|
g = d2.meth (); // set breakpoint here (second)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -55,46 +55,41 @@ gdb_reinitialize_dir $srcdir/$subdir
|
|||||||
gdb_load ${binfile}
|
gdb_load ${binfile}
|
||||||
gdb_load_shlibs ${sofile}
|
gdb_load_shlibs ${sofile}
|
||||||
|
|
||||||
set bp_location [gdb_get_line_number "set breakpoint here"]
|
|
||||||
|
|
||||||
# Set a breakpoint with multiple locations.
|
if ![runto_main] then {
|
||||||
|
perror "couldn't run to breakpoint"
|
||||||
gdb_test "break $srcfile:$bp_location" \
|
return -1
|
||||||
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
|
||||||
"set breakpoint"
|
|
||||||
|
|
||||||
gdb_run_cmd
|
|
||||||
gdb_expect {
|
|
||||||
-re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
|
|
||||||
pass "run to breakpoint"
|
|
||||||
}
|
|
||||||
-re "$gdb_prompt $" {
|
|
||||||
fail "run to breakpoint"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "run to breakpoint (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_test "print d.meth ()" \
|
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
|
||||||
|
gdb_continue_to_breakpoint "set breakpoint here"
|
||||||
|
|
||||||
|
gdb_test "print d1.meth ()" \
|
||||||
".*42.*" \
|
".*42.*" \
|
||||||
"print d.meth ()"
|
"print d1.meth ()"
|
||||||
|
|
||||||
# Now try again. gdb's without the fix will hopefully segv here
|
# Now try again. gdb's without the fix will hopefully segv here
|
||||||
|
|
||||||
gdb_run_cmd
|
runto_main
|
||||||
gdb_expect {
|
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
|
||||||
-re "Breakpoint \[0-9\]+,.*main \\(.*\\).*$gdb_prompt $" {
|
gdb_continue_to_breakpoint "set breakpoint here"
|
||||||
pass "run to breakpoint #2"
|
gdb_test "print d1.meth ()" \
|
||||||
}
|
|
||||||
-re "$gdb_prompt $" {
|
|
||||||
fail "run to breakpoint #2"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "run to breakpoint #2 (timeout)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gdb_test "print d.meth ()" \
|
|
||||||
".*42.*" \
|
".*42.*" \
|
||||||
"gdb2384"
|
"gdb2384"
|
||||||
|
|
||||||
|
# second case
|
||||||
|
|
||||||
|
runto_main
|
||||||
|
gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
|
||||||
|
gdb_continue_to_breakpoint "set breakpoint here (second)"
|
||||||
|
gdb_test "print d2.meth ()" \
|
||||||
|
".*24.*" \
|
||||||
|
"print d2.meth()"
|
||||||
|
|
||||||
|
runto_main
|
||||||
|
gdb_breakpoint [gdb_get_line_number "set breakpoint here (second)"]
|
||||||
|
gdb_continue_to_breakpoint "set breakpoint here (second)"
|
||||||
|
gdb_test "print d2.meth ()" \
|
||||||
|
".*24.*" \
|
||||||
|
"gdb2384 (second)"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user