OLD | NEW |
1 # This testcase is part of GDB, the GNU debugger. | 1 # This testcase is part of GDB, the GNU debugger. |
2 | 2 |
3 # Copyright 1992, 1994-1997, 1999-2000, 2002-2004, 2007-2012 Free | 3 # Copyright 1992, 1994-1997, 1999-2000, 2002-2004, 2007-2012 Free |
4 # Software Foundation, Inc. | 4 # Software Foundation, Inc. |
5 | 5 |
6 # This program is free software; you can redistribute it and/or modify | 6 # This program is free software; you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License as published by | 7 # it under the terms of the GNU General Public License as published by |
8 # the Free Software Foundation; either version 3 of the License, or | 8 # the Free Software Foundation; either version 3 of the License, or |
9 # (at your option) any later version. | 9 # (at your option) any later version. |
10 # | 10 # |
11 # This program is distributed in the hope that it will be useful, | 11 # This program is distributed in the hope that it will be useful, |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 # GNU General Public License for more details. | 14 # GNU General Public License for more details. |
15 # | 15 # |
16 # You should have received a copy of the GNU General Public License | 16 # You should have received a copy of the GNU General Public License |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
19 # Please email any bugs, comments, and/or additions to this file to: | 19 # Please email any bugs, comments, and/or additions to this file to: |
20 # bug-gdb@gnu.org | 20 # bug-gdb@gnu.org |
21 | 21 |
22 # This file was written by Fred Fish. (fnf@cygnus.com) | 22 # This file was written by Fred Fish. (fnf@cygnus.com) |
23 | 23 |
24 if $tracelevel then { | |
25 strace $tracelevel | |
26 } | |
27 | |
28 set testfile "printcmds" | 24 set testfile "printcmds" |
29 set srcfile ${testfile}.c | 25 set srcfile ${testfile}.c |
30 set binfile ${objdir}/${subdir}/${testfile} | 26 set binfile ${objdir}/${subdir}/${testfile} |
31 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { | 27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
32 untested printcmds.exp | 28 untested printcmds.exp |
33 return -1 | 29 return -1 |
34 } | 30 } |
35 | 31 |
36 get_compiler_info ${binfile} | 32 get_compiler_info |
37 | 33 |
38 proc test_integer_literals_accepted {} { | 34 proc test_integer_literals_accepted {} { |
39 global gdb_prompt | 35 global gdb_prompt |
40 | 36 |
41 # Test various decimal values. | 37 # Test various decimal values. |
42 | 38 |
43 gdb_test "p 123" " = 123" | 39 gdb_test "p 123" " = 123" |
44 gdb_test "p -123" " = -123" | 40 gdb_test "p -123" " = -123" |
45 gdb_test "p/d 123" " = 123" | 41 gdb_test "p/d 123" " = 123" |
46 | 42 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 gdb_test "p ctable1\[252\]" " = 252 '\\\\374'" | 415 gdb_test "p ctable1\[252\]" " = 252 '\\\\374'" |
420 gdb_test "p ctable1\[253\]" " = 253 '\\\\375'" | 416 gdb_test "p ctable1\[253\]" " = 253 '\\\\375'" |
421 gdb_test "p ctable1\[254\]" " = 254 '\\\\376'" | 417 gdb_test "p ctable1\[254\]" " = 254 '\\\\376'" |
422 gdb_test "p ctable1\[255\]" " = 255 '\\\\377'" | 418 gdb_test "p ctable1\[255\]" " = 255 '\\\\377'" |
423 } | 419 } |
424 | 420 |
425 # Test interaction of the number of print elements to print and the | 421 # Test interaction of the number of print elements to print and the |
426 # repeat count, set to the default of 10. | 422 # repeat count, set to the default of 10. |
427 | 423 |
428 proc test_print_repeats_10 {} { | 424 proc test_print_repeats_10 {} { |
429 global gdb_prompt | 425 global gdb_prompt decimal |
430 | 426 |
431 for { set x 1; } { $x <= 16 } { incr x; } { | 427 for { set x 1; } { $x <= 16 } { incr x; } { |
432 gdb_test_no_output "set print elements $x" | 428 gdb_test_no_output "set print elements $x" |
433 for { set e 1; } { $e <= 16 } {incr e; } { | 429 for { set e 1; } { $e <= 16 } {incr e; } { |
434 set v [expr $e - 1]; | 430 set v [expr $e - 1]; |
435 set command "p &ctable2\[${v}*16\]" | 431 set command "p &ctable2\[${v}*16\]" |
436 if { $x < $e } { | 432 if { $x < $e } { |
437 set aval $x; | 433 set aval $x; |
438 } else { | 434 } else { |
439 set aval $e; | 435 set aval $e; |
(...skipping 21 matching lines...) Expand all Loading... |
461 set xstr "[string range "XXXXXXXXXXXXXXXX" 1 $xval]\\\""; | 457 set xstr "[string range "XXXXXXXXXXXXXXXX" 1 $xval]\\\""; |
462 } else { | 458 } else { |
463 if { $aval <= 10 } { | 459 if { $aval <= 10 } { |
464 set xstr "\\\""; | 460 set xstr "\\\""; |
465 } | 461 } |
466 } | 462 } |
467 } | 463 } |
468 if { $aval < 16 } { | 464 if { $aval < 16 } { |
469 set xstr "${xstr}\[.\]\[.\]\[.\]" | 465 set xstr "${xstr}\[.\]\[.\]\[.\]" |
470 } | 466 } |
471 » set string " = \[(\]unsigned char \[*\]\[)\] ${a}${xstr}"; | 467 » set string " = \[(\]unsigned char \[*\]\[)\] <ctable2(\\+$decimal)?>
${a}${xstr}"; |
472 gdb_test "$command" "$string" "$command with print elements set to $
x"; | 468 gdb_test "$command" "$string" "$command with print elements set to $
x"; |
473 } | 469 } |
474 } | 470 } |
475 } | 471 } |
476 | 472 |
477 # This tests whether GDB uses the correct element content offsets | 473 # This tests whether GDB uses the correct element content offsets |
478 # (relative to the complete `some_struct' value) when counting value | 474 # (relative to the complete `some_struct' value) when counting value |
479 # repetitions. | 475 # repetitions. |
480 | 476 |
481 proc test_print_repeats_embedded_array {} { | 477 proc test_print_repeats_embedded_array {} { |
482 global gdb_prompt | 478 global gdb_prompt |
483 | 479 |
484 gdb_test_escape_braces "p/x some_struct" \ | 480 gdb_test_escape_braces "p/x some_struct" \ |
485 "= {a = 0x12345678, b = 0x87654321, array = {0xaa <repeats 20 times>}}"
\ | 481 "= {a = 0x12345678, b = 0x87654321, array = {0xaa <repeats 20 times>}}"
\ |
486 "correct element repeats in array embedded at offset > 0" | 482 "correct element repeats in array embedded at offset > 0" |
487 } | 483 } |
488 | 484 |
489 proc test_print_strings {} { | 485 proc test_print_strings {} { |
490 global gdb_prompt | 486 global gdb_prompt decimal |
491 | 487 |
492 # We accept "(unsigned char *) " before the string. char vs. unsigned char | 488 # We accept "(unsigned char *) " before the string. char vs. unsigned char |
493 # is already tested elsewhere. | 489 # is already tested elsewhere. |
494 | 490 |
495 # Test that setting print elements unlimited doesn't completely suppress | 491 # Test that setting print elements unlimited doesn't completely suppress |
496 # printing; this was a bug in older gdb's. | 492 # printing; this was a bug in older gdb's. |
497 gdb_test_no_output "set print elements 0" | 493 gdb_test_no_output "set print elements 0" |
498 gdb_test "p teststring" \ | 494 gdb_test "p teststring" \ |
499 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 0" | 495 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 0" |
500 gdb_test_no_output "set print elements 1" | 496 gdb_test_no_output "set print elements 1" |
501 gdb_test "p teststring" \ | 497 gdb_test "p teststring" \ |
502 " = (.unsigned char .. )?\"t\"\\.\\.\\." "p teststring with elements set
to 1" | 498 " = (.unsigned char .. )?\"t\"\\.\\.\\." "p teststring with elements set
to 1" |
503 gdb_test_no_output "set print elements 5" | 499 gdb_test_no_output "set print elements 5" |
504 gdb_test "p teststring" \ | 500 gdb_test "p teststring" \ |
505 " = (.unsigned char .. )?\"tests\"\\.\\.\\." "p teststring with elements
set to 5" | 501 " = (.unsigned char .. )?\"tests\"\\.\\.\\." "p teststring with elements
set to 5" |
506 gdb_test_no_output "set print elements 19" | 502 gdb_test_no_output "set print elements 19" |
507 gdb_test "p teststring" \ | 503 gdb_test "p teststring" \ |
508 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 19" | 504 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 19" |
509 gdb_test_no_output "set print elements 20" | 505 gdb_test_no_output "set print elements 20" |
510 gdb_test "p teststring" \ | 506 gdb_test "p teststring" \ |
511 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 20" | 507 " = (.unsigned char .. )?\"teststring contents\"" "p teststring with ele
ments set to 20" |
512 | 508 |
513 gdb_test_no_output "set print elements 8" | 509 gdb_test_no_output "set print elements 8" |
514 | 510 |
515 gdb_test "p &ctable1\[0\]" \ | 511 gdb_test "p &ctable1\[0\]" \ |
516 » " = \\(unsigned char \\*\\) \"\"" | 512 » " = \\(unsigned char \\*\\) <ctable1> \"\"" |
517 gdb_test "p &ctable1\[1\]" \ | 513 gdb_test "p &ctable1\[1\]" \ |
518 » " = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006
\\\\a\\\\b\"..." | 514 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\001\\\\002\\\\003
\\\\004\\\\005\\\\006\\\\a\\\\b\"..." |
519 gdb_test "p &ctable1\[1*8\]" \ | 515 gdb_test "p &ctable1\[1*8\]" \ |
520 » " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\0
17\"..." | 516 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\b\\\\t\\\\n\\\\v\
\\\f\\\\r\\\\016\\\\017\"..." |
521 gdb_test "p &ctable1\[2*8\]" \ | 517 gdb_test "p &ctable1\[2*8\]" \ |
522 » " = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025
\\\\026\\\\027\"..." | 518 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\020\\\\021\\\\022
\\\\023\\\\024\\\\025\\\\026\\\\027\"..." |
523 gdb_test "p &ctable1\[3*8\]" \ | 519 gdb_test "p &ctable1\[3*8\]" \ |
524 » " = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035
\\\\036\\\\037\"..." | 520 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\030\\\\031\\\\032
\\\\033\\\\034\\\\035\\\\036\\\\037\"..." |
525 gdb_test "p &ctable1\[4*8\]" \ | 521 gdb_test "p &ctable1\[4*8\]" \ |
526 » " = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..." | 522 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \" !\\\\\"#\\\$%&'\"...
" |
527 gdb_test "p &ctable1\[5*8\]" \ | 523 gdb_test "p &ctable1\[5*8\]" \ |
528 » " = \\(unsigned char \\*\\) \"\\(\\)\\*\\+,-./\"..." | 524 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\(\\)\\*\\+,-./\"...
" |
529 gdb_test "p &ctable1\[6*8\]" \ | 525 gdb_test "p &ctable1\[6*8\]" \ |
530 » " = \\(unsigned char \\*\\) \"01234567\"..." | 526 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"01234567\"..." |
531 gdb_test "p &ctable1\[7*8\]" \ | 527 gdb_test "p &ctable1\[7*8\]" \ |
532 » " = \\(unsigned char \\*\\) \"89:;<=>\\?\"..." | 528 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"89:;<=>\\?\"..." |
533 gdb_test "p &ctable1\[8*8\]" \ | 529 gdb_test "p &ctable1\[8*8\]" \ |
534 » " = \\(unsigned char \\*\\) \"@ABCDEFG\"..." | 530 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"@ABCDEFG\"..." |
535 gdb_test "p &ctable1\[9*8\]" \ | 531 gdb_test "p &ctable1\[9*8\]" \ |
536 » " = \\(unsigned char \\*\\) \"HIJKLMNO\"..." | 532 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"HIJKLMNO\"..." |
537 gdb_test "p &ctable1\[10*8\]" \ | 533 gdb_test "p &ctable1\[10*8\]" \ |
538 » " = \\(unsigned char \\*\\) \"PQRSTUVW\"..." | 534 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"PQRSTUVW\"..." |
539 gdb_test "p &ctable1\[11*8\]" \ | 535 gdb_test "p &ctable1\[11*8\]" \ |
540 » " = \\(unsigned char \\*\\) \"XYZ\\\[\\\\\\\\\\\]\\^_\"..." | 536 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"XYZ\\\[\\\\\\\\\\\]\\
^_\"..." |
541 gdb_test "p &ctable1\[12*8\]" \ | 537 gdb_test "p &ctable1\[12*8\]" \ |
542 » " = \\(unsigned char \\*\\) \"`abcdefg\"..." | 538 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"`abcdefg\"..." |
543 gdb_test "p &ctable1\[13*8\]" \ | 539 gdb_test "p &ctable1\[13*8\]" \ |
544 » " = \\(unsigned char \\*\\) \"hijklmno\"..." | 540 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"hijklmno\"..." |
545 gdb_test "p &ctable1\[14*8\]" \ | 541 gdb_test "p &ctable1\[14*8\]" \ |
546 » " = \\(unsigned char \\*\\) \"pqrstuvw\"..." | 542 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"pqrstuvw\"..." |
547 gdb_test "p &ctable1\[15*8\]" \ | 543 gdb_test "p &ctable1\[15*8\]" \ |
548 » " = \\(unsigned char \\*\\) \"xyz\[{|}\]+\\~\\\\177\"..." | 544 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"xyz\[{|}\]+\\~\\\\177
\"..." |
549 gdb_test "p &ctable1\[16*8\]" \ | 545 gdb_test "p &ctable1\[16*8\]" \ |
550 » " = \\(unsigned char \\*\\) \"\\\\200\\\\201\\\\202\\\\203\\\\204\\\\205
\\\\206\\\\207\"..." | 546 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\200\\\\201\\\\202
\\\\203\\\\204\\\\205\\\\206\\\\207\"..." |
551 gdb_test "p &ctable1\[17*8\]" \ | 547 gdb_test "p &ctable1\[17*8\]" \ |
552 » " = \\(unsigned char \\*\\) \"\\\\210\\\\211\\\\212\\\\213\\\\214\\\\215
\\\\216\\\\217\"..." | 548 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\210\\\\211\\\\212
\\\\213\\\\214\\\\215\\\\216\\\\217\"..." |
553 gdb_test "p &ctable1\[18*8\]" \ | 549 gdb_test "p &ctable1\[18*8\]" \ |
554 » " = \\(unsigned char \\*\\) \"\\\\220\\\\221\\\\222\\\\223\\\\224\\\\225
\\\\226\\\\227\"..." | 550 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\220\\\\221\\\\222
\\\\223\\\\224\\\\225\\\\226\\\\227\"..." |
555 gdb_test "p &ctable1\[19*8\]" \ | 551 gdb_test "p &ctable1\[19*8\]" \ |
556 » " = \\(unsigned char \\*\\) \"\\\\230\\\\231\\\\232\\\\233\\\\234\\\\235
\\\\236\\\\237\"..." | 552 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\230\\\\231\\\\232
\\\\233\\\\234\\\\235\\\\236\\\\237\"..." |
557 gdb_test "p &ctable1\[20*8\]" \ | 553 gdb_test "p &ctable1\[20*8\]" \ |
558 » " = \\(unsigned char \\*\\) \"\\\\240\\\\241\\\\242\\\\243\\\\244\\\\245
\\\\246\\\\247\"..." | 554 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\240\\\\241\\\\242
\\\\243\\\\244\\\\245\\\\246\\\\247\"..." |
559 gdb_test "p &ctable1\[21*8\]" \ | 555 gdb_test "p &ctable1\[21*8\]" \ |
560 » " = \\(unsigned char \\*\\) \"\\\\250\\\\251\\\\252\\\\253\\\\254\\\\255
\\\\256\\\\257\"..." | 556 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\250\\\\251\\\\252
\\\\253\\\\254\\\\255\\\\256\\\\257\"..." |
561 gdb_test "p &ctable1\[22*8\]" \ | 557 gdb_test "p &ctable1\[22*8\]" \ |
562 » " = \\(unsigned char \\*\\) \"\\\\260\\\\261\\\\262\\\\263\\\\264\\\\265
\\\\266\\\\267\"..." | 558 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\260\\\\261\\\\262
\\\\263\\\\264\\\\265\\\\266\\\\267\"..." |
563 gdb_test "p &ctable1\[23*8\]" \ | 559 gdb_test "p &ctable1\[23*8\]" \ |
564 » " = \\(unsigned char \\*\\) \"\\\\270\\\\271\\\\272\\\\273\\\\274\\\\275
\\\\276\\\\277\"..." | 560 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\270\\\\271\\\\272
\\\\273\\\\274\\\\275\\\\276\\\\277\"..." |
565 gdb_test "p &ctable1\[24*8\]" \ | 561 gdb_test "p &ctable1\[24*8\]" \ |
566 » " = \\(unsigned char \\*\\) \"\\\\300\\\\301\\\\302\\\\303\\\\304\\\\305
\\\\306\\\\307\"..." | 562 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\300\\\\301\\\\302
\\\\303\\\\304\\\\305\\\\306\\\\307\"..." |
567 gdb_test "p &ctable1\[25*8\]" \ | 563 gdb_test "p &ctable1\[25*8\]" \ |
568 » " = \\(unsigned char \\*\\) \"\\\\310\\\\311\\\\312\\\\313\\\\314\\\\315
\\\\316\\\\317\"..." | 564 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\310\\\\311\\\\312
\\\\313\\\\314\\\\315\\\\316\\\\317\"..." |
569 gdb_test "p &ctable1\[26*8\]" \ | 565 gdb_test "p &ctable1\[26*8\]" \ |
570 » " = \\(unsigned char \\*\\) \"\\\\320\\\\321\\\\322\\\\323\\\\324\\\\325
\\\\326\\\\327\"..." | 566 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\320\\\\321\\\\322
\\\\323\\\\324\\\\325\\\\326\\\\327\"..." |
571 gdb_test "p &ctable1\[27*8\]" \ | 567 gdb_test "p &ctable1\[27*8\]" \ |
572 » " = \\(unsigned char \\*\\) \"\\\\330\\\\331\\\\332\\\\333\\\\334\\\\335
\\\\336\\\\337\"..." | 568 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\330\\\\331\\\\332
\\\\333\\\\334\\\\335\\\\336\\\\337\"..." |
573 gdb_test "p &ctable1\[28*8\]" \ | 569 gdb_test "p &ctable1\[28*8\]" \ |
574 » " = \\(unsigned char \\*\\) \"\\\\340\\\\341\\\\342\\\\343\\\\344\\\\345
\\\\346\\\\347\"..." | 570 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\340\\\\341\\\\342
\\\\343\\\\344\\\\345\\\\346\\\\347\"..." |
575 gdb_test "p &ctable1\[29*8\]" \ | 571 gdb_test "p &ctable1\[29*8\]" \ |
576 » " = \\(unsigned char \\*\\) \"\\\\350\\\\351\\\\352\\\\353\\\\354\\\\355
\\\\356\\\\357\"..." | 572 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\350\\\\351\\\\352
\\\\353\\\\354\\\\355\\\\356\\\\357\"..." |
577 gdb_test "p &ctable1\[30*8\]" \ | 573 gdb_test "p &ctable1\[30*8\]" \ |
578 » " = \\(unsigned char \\*\\) \"\\\\360\\\\361\\\\362\\\\363\\\\364\\\\365
\\\\366\\\\367\"..." | 574 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\360\\\\361\\\\362
\\\\363\\\\364\\\\365\\\\366\\\\367\"..." |
579 gdb_test "p &ctable1\[31*8\]" \ | 575 gdb_test "p &ctable1\[31*8\]" \ |
580 » " = \\(unsigned char \\*\\) \"\\\\370\\\\371\\\\372\\\\373\\\\374\\\\375
\\\\376\\\\377\"..." | 576 » " = \\(unsigned char \\*\\) <ctable1\\+$decimal> \"\\\\370\\\\371\\\\372
\\\\373\\\\374\\\\375\\\\376\\\\377\"..." |
581 } | 577 } |
582 | 578 |
583 proc test_print_int_arrays {} { | 579 proc test_print_int_arrays {} { |
584 global gdb_prompt | 580 global gdb_prompt |
585 | 581 |
586 gdb_test_no_output "set print elements 24" | 582 gdb_test_no_output "set print elements 24" |
587 | 583 |
588 gdb_test_escape_braces "p int1dim" \ | 584 gdb_test_escape_braces "p int1dim" \ |
589 " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" | 585 " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" |
590 gdb_test_escape_braces "p int2dim" \ | 586 gdb_test_escape_braces "p int2dim" \ |
(...skipping 30 matching lines...) Expand all Loading... |
621 gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} | 617 gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} |
622 gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \ | 618 gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \ |
623 "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ | 619 "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ |
624 {p int1dim[0]@2@3} | 620 {p int1dim[0]@2@3} |
625 gdb_test_escape_braces {p/x (short [])0x12345678} \ | 621 gdb_test_escape_braces {p/x (short [])0x12345678} \ |
626 " = ({0x1234, 0x5678}|{0x5678, 0x1234})" | 622 " = ({0x1234, 0x5678}|{0x5678, 0x1234})" |
627 } | 623 } |
628 | 624 |
629 proc test_print_char_arrays {} { | 625 proc test_print_char_arrays {} { |
630 global gdb_prompt | 626 global gdb_prompt |
631 global hex | 627 global hex decimal |
632 | 628 |
633 gdb_test_no_output "set print elements 24" | 629 gdb_test_no_output "set print elements 24" |
634 gdb_test_no_output "set print address on" | 630 gdb_test_no_output "set print address on" |
635 | 631 |
636 gdb_test "p arrays" \ | 632 gdb_test "p arrays" \ |
637 " = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\",
array5 = \"hij\"}" | 633 " = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\",
array5 = \"hij\"}" |
638 | 634 |
639 gdb_test "p parrays"» » " = \\(struct some_arrays \\*\\) $hex" | 635 gdb_test "p parrays"» » " = \\(struct some_arrays \\*\\) $hex <a
rrays>" |
640 gdb_test "p parrays->array1" " = \"abc\"" | 636 gdb_test "p parrays->array1" " = \"abc\"" |
641 gdb_test "p &parrays->array1"» " = \\(unsigned char \\(\\*\\)\\\[4\\\]\
\) $hex" | 637 gdb_test "p &parrays->array1"» " = \\(unsigned char \\(\\*\\)\\\[4\\\]\
\) $hex <arrays>" |
642 gdb_test "p parrays->array2" " = \"d\"" | 638 gdb_test "p parrays->array2" " = \"d\"" |
643 gdb_test "p &parrays->array2"» " = \\(unsigned char \\(\\*\\)\\\[1\\\]\
\) $hex" | 639 gdb_test "p &parrays->array2"» " = \\(unsigned char \\(\\*\\)\\\[1\\\]\
\) $hex <arrays\\+$decimal>" |
644 gdb_test "p parrays->array3" " = \"e\"" | 640 gdb_test "p parrays->array3" " = \"e\"" |
645 gdb_test "p &parrays->array3"» " = \\(unsigned char \\(\\*\\)\\\[1\\\]\
\) $hex" | 641 gdb_test "p &parrays->array3"» " = \\(unsigned char \\(\\*\\)\\\[1\\\]\
\) $hex <arrays\\+$decimal>" |
646 gdb_test "p parrays->array4" " = \"fg\"" | 642 gdb_test "p parrays->array4" " = \"fg\"" |
647 gdb_test "p &parrays->array4"» " = \\(unsigned char \\(\\*\\)\\\[2\\\]\
\) $hex" | 643 gdb_test "p &parrays->array4"» " = \\(unsigned char \\(\\*\\)\\\[2\\\]\
\) $hex <arrays\\+$decimal>" |
648 gdb_test "p parrays->array5" " = \"hij\"" | 644 gdb_test "p parrays->array5" " = \"hij\"" |
649 gdb_test "p &parrays->array5"» " = \\(unsigned char \\(\\*\\)\\\[4\\\]\
\) $hex" | 645 gdb_test "p &parrays->array5"» " = \\(unsigned char \\(\\*\\)\\\[4\\\]\
\) $hex <arrays\\+$decimal>" |
650 | 646 |
651 gdb_test_no_output "set print address off" | 647 gdb_test_no_output "set print address off" |
652 } | 648 } |
653 | 649 |
654 proc test_print_string_constants {} { | 650 proc test_print_string_constants {} { |
655 global gdb_prompt | 651 global gdb_prompt |
656 | 652 |
657 gdb_test_no_output "set print elements 50" | 653 gdb_test_no_output "set print elements 50" |
658 | 654 |
659 if [target_info exists gdb,cannot_call_functions] { | 655 if [target_info exists gdb,cannot_call_functions] { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 gdb_test_escape_braces "print {0,1,2}" " = {0, 1, 2}" | 690 gdb_test_escape_braces "print {0,1,2}" " = {0, 1, 2}" |
695 gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" | 691 gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" |
696 gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}
" | 692 gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}
" |
697 gdb_test "print {4,5,6}\[2\]" " = 6" | 693 gdb_test "print {4,5,6}\[2\]" " = 6" |
698 gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not lo
cated in memory." | 694 gdb_test "print *&{4,5,6}\[1\]" "Attempt to take address of value not lo
cated in memory." |
699 } | 695 } |
700 | 696 |
701 proc test_print_enums {} { | 697 proc test_print_enums {} { |
702 # Regression test for PR11827. | 698 # Regression test for PR11827. |
703 gdb_test "print some_volatile_enum" "enumvolval1" | 699 gdb_test "print some_volatile_enum" "enumvolval1" |
| 700 |
| 701 gdb_test "print three" " = \\\(ONE \\| TWO\\\)" |
704 } | 702 } |
705 | 703 |
706 proc test_printf {} { | 704 proc test_printf {} { |
707 gdb_test "printf \"x=%d,y=%d,z=%d\\n\", 5, 6, 7" "x=5,y=6,z=7" | 705 gdb_test "printf \"x=%d,y=%d,z=%d\\n\", 5, 6, 7" "x=5,y=6,z=7" |
708 gdb_test "printf \"string=%.4sxx\\n\", teststring" "string=testxx" | 706 gdb_test "printf \"string=%.4sxx\\n\", teststring" "string=testxx" |
709 gdb_test "printf \"string=%sxx\\n\", teststring" \ | 707 gdb_test "printf \"string=%sxx\\n\", teststring" \ |
710 "string=teststring contentsxx" | 708 "string=teststring contentsxx" |
711 | 709 |
712 gdb_test "printf \"%f is fun\\n\", 1.0" "1\.0+ is fun" | 710 gdb_test "printf \"%f is fun\\n\", 1.0" "1\.0+ is fun" |
713 | 711 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 gdb_test "printf \"%DDf\\n\",-1234567890123456789012345678901234.dl" "-12345
67890123456789012345678901234" | 766 gdb_test "printf \"%DDf\\n\",-1234567890123456789012345678901234.dl" "-12345
67890123456789012345678901234" |
769 | 767 |
770 gdb_test "printf \"%DDf\\n\",1.2E1dl" "12" | 768 gdb_test "printf \"%DDf\\n\",1.2E1dl" "12" |
771 gdb_test "printf \"%DDf\\n\",1.2E10dl" "1.2E\\+10" | 769 gdb_test "printf \"%DDf\\n\",1.2E10dl" "1.2E\\+10" |
772 gdb_test "printf \"%DDf\\n\",1.2E-10dl" "1.2E-10" | 770 gdb_test "printf \"%DDf\\n\",1.2E-10dl" "1.2E-10" |
773 | 771 |
774 # The largest exponent for 128-bit dfp value is 6144. | 772 # The largest exponent for 128-bit dfp value is 6144. |
775 gdb_test "printf \"%DDf\\n\",1.2E6144dl" "1.20000000000000000000000000000000
0E\\+6144" | 773 gdb_test "printf \"%DDf\\n\",1.2E6144dl" "1.20000000000000000000000000000000
0E\\+6144" |
776 } | 774 } |
777 | 775 |
| 776 proc test_print_symbol {} { |
| 777 gdb_test_no_output "set print symbol on" |
| 778 |
| 779 gdb_test "print &three" " = .* <three>" |
| 780 gdb_test "print parrays" " = .* <arrays>" |
| 781 |
| 782 # In case somebody adds tests after this. |
| 783 gdb_test_no_output "set print symbol off" |
| 784 } |
| 785 |
778 # Escape a left curly brace to prevent it from being interpreted as | 786 # Escape a left curly brace to prevent it from being interpreted as |
779 # the beginning of a bound | 787 # the beginning of a bound |
780 proc gdb_test_escape_braces { args } { | 788 proc gdb_test_escape_braces { args } { |
781 | 789 |
782 set pattern [lindex $args 1] | 790 set pattern [lindex $args 1] |
783 regsub -all {\{[0-9]} $pattern {\\&} esc_pattern | 791 regsub -all {\{[0-9]} $pattern {\\&} esc_pattern |
784 gdb_test [lindex $args 0] $esc_pattern [lindex $args 2] | 792 gdb_test [lindex $args 0] $esc_pattern [lindex $args 2] |
785 } | 793 } |
786 | 794 |
787 # Start with a fresh gdb. | 795 # Start with a fresh gdb. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 test_print_int_arrays | 843 test_print_int_arrays |
836 test_print_typedef_arrays | 844 test_print_typedef_arrays |
837 test_artificial_arrays | 845 test_artificial_arrays |
838 test_print_char_arrays | 846 test_print_char_arrays |
839 # We used to do the runto main here. | 847 # We used to do the runto main here. |
840 test_print_string_constants | 848 test_print_string_constants |
841 test_print_array_constants | 849 test_print_array_constants |
842 test_print_enums | 850 test_print_enums |
843 test_printf | 851 test_printf |
844 test_printf_with_dfp | 852 test_printf_with_dfp |
| 853 test_print_symbol |
OLD | NEW |