X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Frelocate.exp;h=d0a839ae59c39136f5081cd833957eae3030290d;hb=40fc416f4e22913ba2a2bafcc8da05f59c677b7d;hp=6eef15fb20e3aa2c43dc6b3e5662053dc2ae9508;hpb=7f0f8ac8b15f5f5327116614b4137e5dd533ada2;p=external%2Fbinutils.git diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp index 6eef15f..d0a839a 100644 --- a/gdb/testsuite/gdb.base/relocate.exp +++ b/gdb/testsuite/gdb.base/relocate.exp @@ -37,6 +37,92 @@ foreach x {"-raednow" "readnow" "foo" "-readnow s"} { "add-symbol-file: unknown option $word" } +# Check that we can pass parameters using any position in the command +# line. +set test "add-symbol-file positionless -readnow" +gdb_test_multiple "add-symbol-file -readnow $binfile 0x100 -s .bss 0x3" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +# When we use -s as the first argument, the section will be printed +# first as well. +set test "add-symbol-file positionless -s" +gdb_test_multiple "add-symbol-file -s .bss 0x3 -readnow $binfile 0x100" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +set test "add-symbol-file positionless -s, no -readnow" +gdb_test_multiple "add-symbol-file $binfile 0x100 -s .bss 0x3" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +# Check that passing "-s .text", no matter the position, always has +# the same result. +set test "add-symbol-file different -s .text, after file" +gdb_test_multiple "add-symbol-file $binfile 0x100 -s .text 0x200" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.text_addr = 0x200\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +set test "add-symbol-file different -s .text, before file" +gdb_test_multiple "add-symbol-file -s .text 0x200 $binfile 0x100" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.text_addr = 0x200\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +# Test that passing "--" disables option processing. +gdb_test "add-symbol-file -- $binfile 0x100 -s .bss 0x3" \ + "Unrecognized argument \"-s\"" \ + "add-symbol-file with -- disables option processing" +set test "add-symbol-file with -- disables option processing, non-existent filename" +gdb_test_multiple "add-symbol-file -- -non-existent-file 0x100" $test { + -re "add symbol table from file \"-non-existent-file\" at\r\n\t\.text_addr = 0x100\r\n\\(y or n\\) " { + gdb_test "y" "-non-existent-file: No such file or directory\." $test + } +} +# Test that passing the wrong number of arguments to '-s' leads to an +# error. +gdb_test "add-symbol-file $binfile -s" \ + "Missing section name after \"-s\"" \ + "add-symbol-file with -s without section name" +gdb_test "add-symbol-file $binfile -s .bss" \ + "Missing section address after \"-s\"" \ + "add-symbol-file with -s without section address" +# Test that '-s' accepts section names with '-' +set test "add-symbol-file with -s using section name starting with dash" +gdb_test_multiple "add-symbol-file -s -section-name 0x200 $binfile 0x100" $test { + -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\-section-name_addr = 0x200\r\n\\(y or n\\) " { + gdb_test "n" "Not confirmed\." $test + } +} +# Since we're here, might as well test the 'symbol-file' command and +# if its arguments can also be passed at any position. +gdb_test "symbol-file -readnow $binfile" \ + "Reading symbols from ${binfile}\.\.\.expanding to full symbols\.\.\.done\." \ + "symbol-file with -readnow first" +clean_restart +gdb_test "symbol-file $binfile -readnow" \ + "Reading symbols from ${binfile}\.\.\.expanding to full symbols\.\.\.done\." \ + "symbol-file with -readnow second" +gdb_test "symbol-file -readnow" \ + "no symbol file name was specified" \ + "symbol-file without filename" +gdb_test "symbol-file -- -non-existent-file" \ + "-non-existent-file: No such file or directory\." \ + "symbol-file with -- disables option processing" +clean_restart +gdb_test "symbol-file -readnow -- $binfile" \ + "Reading symbols from ${binfile}\.\.\.expanding to full symbols\.\.\.done\." \ + "symbol-file with -- and -readnow" +gdb_test "symbol-file -- $binfile -readnow" \ + "Unrecognized argument \"-readnow\"" \ + "symbol-file with -- and -readnow, invalid option" + +clean_restart + gdb_test "add-symbol-file ${binfile} 0 -s" \ "Missing section name after .-s." \ "add-symbol-file bare -s"