mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
gdb
* c-exp.y (name_not_typename): Add 'operator' clause. gdb/testsuite * gdb.cp/userdef.exp: Add tests for explicit calls to operator==. * gdb.cp/userdef.cc (operator==): New function. (main): New locals mem1, mem2.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2010-03-15 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* c-exp.y (name_not_typename): Add 'operator' clause.
|
||||||
|
|
||||||
2010-03-15 Ralf Corsepius <ralf.corsepius@rtems.org>
|
2010-03-15 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* configure.ac: Exit if ${gdb_target_obs}" is not set.
|
* configure.ac: Exit if ${gdb_target_obs}" is not set.
|
||||||
|
@ -1236,6 +1236,14 @@ name_not_typename : NAME
|
|||||||
context where only a name could occur, this might be useful.
|
context where only a name could occur, this might be useful.
|
||||||
| NAME_OR_INT
|
| NAME_OR_INT
|
||||||
*/
|
*/
|
||||||
|
| operator
|
||||||
|
{
|
||||||
|
$$.stoken = $1;
|
||||||
|
$$.sym = lookup_symbol ($1.ptr,
|
||||||
|
expression_context_block,
|
||||||
|
VAR_DOMAIN,
|
||||||
|
&$$.is_a_field_of_this);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2010-03-15 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* gdb.cp/userdef.exp: Add tests for explicit calls to operator==.
|
||||||
|
* gdb.cp/userdef.cc (operator==): New function.
|
||||||
|
(main): New locals mem1, mem2.
|
||||||
|
|
||||||
2010-03-15 Jie Zhang <jie@codesourcery.com>
|
2010-03-15 Jie Zhang <jie@codesourcery.com>
|
||||||
|
|
||||||
* lib/mi-support.exp (mi_gdb_target_load): Delete unused timeout var.
|
* lib/mi-support.exp (mi_gdb_target_load): Delete unused timeout var.
|
||||||
|
@ -311,6 +311,11 @@ public:
|
|||||||
int z;
|
int z;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool operator== (const Member &m1, const Member &m2)
|
||||||
|
{
|
||||||
|
return m1.z == m2.z;
|
||||||
|
}
|
||||||
|
|
||||||
class Container
|
class Container
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -330,8 +335,12 @@ int main (void)
|
|||||||
A1 two(4,5);
|
A1 two(4,5);
|
||||||
A1 three(0,0);
|
A1 three(0,0);
|
||||||
Container c;
|
Container c;
|
||||||
|
Member mem1, mem2;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
mem1.z = 5;
|
||||||
|
mem2.z = 7;
|
||||||
|
|
||||||
marker1(); // marker1-returns-here
|
marker1(); // marker1-returns-here
|
||||||
cout << one; // marker1-returns-here
|
cout << one; // marker1-returns-here
|
||||||
cout << two;
|
cout << two;
|
||||||
|
@ -113,6 +113,7 @@ gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]"
|
|||||||
gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]"
|
gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]"
|
||||||
|
|
||||||
gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]"
|
gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]"
|
||||||
|
gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0\[\r\n\]"
|
||||||
|
|
||||||
gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]"
|
gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]"
|
||||||
|
|
||||||
@ -155,5 +156,8 @@ gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
|
|||||||
gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
|
gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
|
||||||
gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*"
|
gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*"
|
||||||
|
|
||||||
|
gdb_test "print operator== (mem1, mem2)" " = false"
|
||||||
|
gdb_test "print operator== (mem1, mem1)" " = true"
|
||||||
|
|
||||||
gdb_exit
|
gdb_exit
|
||||||
return 0
|
return 0
|
||||||
|
Reference in New Issue
Block a user