OLD | NEW |
1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2013 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This file is part of the gdb testsuite | 16 # This file is part of the gdb testsuite |
17 | 17 |
18 # Test the memory attribute commands. | 18 # Test the memory attribute commands. |
19 | 19 |
20 set testfile "memattr" | 20 standard_testfile .c |
21 set srcfile ${testfile}.c | |
22 | 21 |
23 if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { | 22 if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { |
24 return -1 | 23 return -1 |
25 } | 24 } |
26 | 25 |
27 runto main | 26 runto main |
28 | 27 |
29 set mem1start -1 | 28 set mem1start -1 |
30 set mem2start -1 | 29 set mem2start -1 |
31 set mem3start -1 | 30 set mem3start -1 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if { !$see1 && !$see2 && !$see3 && !$see4 && $see5 } then { | 440 if { !$see1 && !$see2 && !$see3 && !$see4 && $see5 } then { |
442 pass "mem 2-4 were deleted" | 441 pass "mem 2-4 were deleted" |
443 } else { | 442 } else { |
444 fail "mem 2-4 were deleted" | 443 fail "mem 2-4 were deleted" |
445 } | 444 } |
446 } | 445 } |
447 } | 446 } |
448 | 447 |
449 gdb_test "delete mem 8" "No memory region number 8." \ | 448 gdb_test "delete mem 8" "No memory region number 8." \ |
450 "delete non-existant region" | 449 "delete non-existant region" |
| 450 |
| 451 # |
| 452 # Test overlapping checking |
| 453 # |
| 454 |
| 455 proc delete_memory {} { |
| 456 global gdb_prompt |
| 457 |
| 458 gdb_test_multiple "delete mem" "delete mem" { |
| 459 -re "Delete all memory regions.*y or n.*$" { |
| 460 send_gdb "y\n" |
| 461 exp_continue |
| 462 } |
| 463 -re "$gdb_prompt $" { } |
| 464 } |
| 465 } |
| 466 |
| 467 # Create a region that doesn't overlap (a PASS in the table). |
| 468 |
| 469 proc region_pass { region } { |
| 470 gdb_test_no_output "mem $region ro" "$region: no-overlap" |
| 471 } |
| 472 |
| 473 # Try to create a region that overlaps (a FAIL in the table). |
| 474 |
| 475 proc region_fail { region } { |
| 476 gdb_test "mem $region ro" "overlapping memory region" "$region: overlap" |
| 477 } |
| 478 |
| 479 # Test normal case (upper != 0) |
| 480 # |
| 481 # lo' hi' |
| 482 # |--------| |
| 483 # 10 20 30 40 50 60 70 80 90 |
| 484 # |-----| FAIL |
| 485 # |--| FAIL |
| 486 # |--| FAIL |
| 487 # |--| FAIL |
| 488 # |-----| FAIL |
| 489 # |--------| FAIL |
| 490 # |--------------| FAIL |
| 491 # |--------------------- FAIL |
| 492 # |------------------ FAIL |
| 493 # |--------------- FAIL |
| 494 # |--| PASS |
| 495 # |--| PASS |
| 496 # |--- PASS |
| 497 |
| 498 delete_memory |
| 499 gdb_test_no_output "mem 0x30 0x60 ro" |
| 500 with_test_prefix "0x30 0x60" { |
| 501 region_fail "0x20 0x40" |
| 502 region_fail "0x30 0x40" |
| 503 region_fail "0x40 0x50" |
| 504 region_fail "0x50 0x60" |
| 505 region_fail "0x50 0x70" |
| 506 region_fail "0x30 0x60" |
| 507 region_fail "0x20 0x70" |
| 508 region_fail "0x20 0x0" |
| 509 region_fail "0x30 0x0" |
| 510 region_fail "0x40 0x0" |
| 511 region_pass "0x20 0x30" |
| 512 region_pass "0x60 0x70" |
| 513 region_pass "0x80 0x0" |
| 514 } |
| 515 |
| 516 # Test special case (upper == 0) |
| 517 # |
| 518 # lo' hi' |
| 519 # |--------------- |
| 520 # 00 10 20 30 40 50 60 70 80 |
| 521 # |--------| FAIL |
| 522 # |-----| FAIL |
| 523 # |--| FAIL |
| 524 # |------------------ FAIL |
| 525 # |--------------- FAIL |
| 526 # |------------ FAIL |
| 527 # |--| PASS |
| 528 # |--| PASS |
| 529 |
| 530 delete_memory |
| 531 gdb_test_no_output "mem 0x30 0x0 ro" |
| 532 with_test_prefix "0x30 0x0" { |
| 533 region_fail "0x20 0x50" |
| 534 region_fail "0x30 0x50" |
| 535 region_fail "0x40 0x50" |
| 536 region_fail "0x20 0x0" |
| 537 region_fail "0x30 0x0" |
| 538 region_fail "0x40 0x0" |
| 539 region_pass "0x20 0x30" |
| 540 region_pass "0x00 0x10" |
| 541 } |
OLD | NEW |