mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 09:09:16 +08:00
gdb/testsuite/
* gdb.cp/formatted-ref.exp (test_p_x_ref_addr): Allow the reference to be in memory. * gdb.base/display.c (force_mem): New. (do_loops): Use it. Add breakpoint comments. (do_vars): Add a breakpoint comment. * gdb.base/display.exp: Use gdb_get_line_number. Remove hardcoded line numbers.
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
2009-11-13 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.cp/formatted-ref.exp (test_p_x_ref_addr): Allow the reference
|
||||||
|
to be in memory.
|
||||||
|
* gdb.base/display.c (force_mem): New.
|
||||||
|
(do_loops): Use it. Add breakpoint comments.
|
||||||
|
(do_vars): Add a breakpoint comment.
|
||||||
|
* gdb.base/display.exp: Use gdb_get_line_number. Remove hardcoded
|
||||||
|
line numbers.
|
||||||
|
|
||||||
2009-11-13 Nathan Froyd <froydnj@codesourcery.com>
|
2009-11-13 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
* gdb.base/pending.exp: Use gdb_run_cmd to start the program
|
* gdb.base/pending.exp: Use gdb_run_cmd to start the program
|
||||||
|
@ -5,20 +5,23 @@
|
|||||||
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
|
|
||||||
|
/* Call to force a variable onto the stack so we can see its address. */
|
||||||
|
void force_mem (int *arg) { }
|
||||||
|
|
||||||
int do_loops()
|
int do_loops()
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
int k=0;
|
int k=0;
|
||||||
int j=0;
|
int j=0;
|
||||||
float f=3.1415;
|
float f=3.1415;
|
||||||
for( i = 0; i < LOOP; i++ ) {
|
for( i = 0; i < LOOP; i++ ) { /* set breakpoint 1 here */
|
||||||
for( j = 0; j < LOOP; j++ ) {
|
for( j = 0; j < LOOP; j++ ) {
|
||||||
for( k = 0; k < LOOP; k++ ) {
|
for( k = 0; k < LOOP; k++ ) {
|
||||||
sum++; f++;
|
sum++; f++; force_mem (&k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return i; /* set breakpoint 2 here */
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_vars()
|
int do_vars()
|
||||||
@ -34,7 +37,7 @@ int do_vars()
|
|||||||
/* Need some code here to set breaks on.
|
/* Need some code here to set breaks on.
|
||||||
*/
|
*/
|
||||||
for( j = 0; j < LOOP; j++ ) {
|
for( j = 0; j < LOOP; j++ ) {
|
||||||
if( p_c[j] == c ) {
|
if( p_c[j] == c ) { /* set breakpoint 3 here */
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -78,13 +78,15 @@ if [target_info exists gdb,no_hardware_watchpoints] {
|
|||||||
gdb_test "set can-use-hw-watchpoints 0" "" ""
|
gdb_test "set can-use-hw-watchpoints 0" "" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_test "break 14" ".*Breakpoint 2.*" "break do_loops"
|
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
|
||||||
|
gdb_test "break $bp_location1" ".*Breakpoint 2.*" "break do_loops"
|
||||||
gdb_test "cont" ".*Breakpoint 2, do_loops.*" "get to do_loops"
|
gdb_test "cont" ".*Breakpoint 2, do_loops.*" "get to do_loops"
|
||||||
|
|
||||||
# Create stopping points.
|
# Create stopping points.
|
||||||
#
|
#
|
||||||
gdb_test "watch sum" ".*\[Ww\]atchpoint 3: sum.*" "set watch"
|
gdb_test "watch sum" ".*\[Ww\]atchpoint 3: sum.*" "set watch"
|
||||||
gdb_test "break 19" ".*Breakpoint 4.*" "break 19"
|
set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
|
||||||
|
gdb_test "break $bp_location2" ".*Breakpoint 4.*" "break loop end"
|
||||||
|
|
||||||
# Create displays for those points
|
# Create displays for those points
|
||||||
#
|
#
|
||||||
@ -161,9 +163,10 @@ gdb_expect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_test "step" ".*do_vars.*.*27.*"
|
gdb_test "step" ".*do_vars.*.*i = 9.*"
|
||||||
gdb_test "tbreak 37" ".*breakpoint 5 a.*"
|
set bp_location3 [gdb_get_line_number "set breakpoint 3 here"]
|
||||||
gdb_test "cont" ".*do_vars.*37.*37.*"
|
gdb_test "tbreak $bp_location3" ".*breakpoint 5 a.*" "tbreak in do_vars"
|
||||||
|
gdb_test "cont" ".*do_vars.*$bp_location3.*$bp_location3.*"
|
||||||
|
|
||||||
# Beat on printf a bit
|
# Beat on printf a bit
|
||||||
#
|
#
|
||||||
|
@ -101,7 +101,12 @@ proc test_p_x_ref_addr { var addr } {
|
|||||||
gdb_test_multiple $test $test {
|
gdb_test_multiple $test $test {
|
||||||
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
|
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
|
||||||
pass $test
|
pass $test
|
||||||
}
|
}
|
||||||
|
-re "Attempt to take address of value not located in memory.*$gdb_prompt $" {
|
||||||
|
# The reference might be in a register. At least we parsed
|
||||||
|
# correctly...
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
-re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
|
-re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
|
||||||
fail "$test (prints unexpected address)"
|
fail "$test (prints unexpected address)"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user