Fix two regressions in scalar printing
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / printcmds.exp
index 7937fe7321acf2fe290db74d0d498d94955580fb..9409c6ad8db99ecd5a003cafa7985f7c495144aa 100644 (file)
@@ -1,6 +1,6 @@
 # This testcase is part of GDB, the GNU debugger.
 
-# Copyright 1992-2016 Free Software Foundation, Inc.
+# Copyright 1992-2017 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
 standard_testfile .c
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     untested printcmds.exp
+     untested "failed to compile"
      return -1
 }
 
@@ -155,6 +155,16 @@ proc test_float_rejected {} {
     test_print_reject "p 1.1ll"
 }
 
+# Regression test for PR gdb/21675
+proc test_radices {} {
+    gdb_test "print/o 16777211" " = 077777773"
+    gdb_test "print/d 1.5" " = 1"
+    gdb_test "print/u 1.5" " = 1"
+
+    gdb_test "print/u (char) -1" " = 255"
+    gdb_test "print/d (unsigned char) -1" " = -1"
+}
+
 proc test_print_all_chars {} {
     global gdb_prompt
 
@@ -683,7 +693,7 @@ proc test_print_string_constants {} {
     gdb_test_no_output "set print elements 50"
 
     if [target_info exists gdb,cannot_call_functions] {
-       unsupported "This target can not call functions"
+       unsupported "this target can not call functions"
        return
     }
 
@@ -706,7 +716,7 @@ proc test_print_string_constants {} {
 proc test_print_array_constants {} {
 
     if [target_info exists gdb,cannot_call_functions] {
-       unsupported "This target can not call functions"
+       unsupported "this target can not call functions"
        return
     }
 
@@ -931,6 +941,12 @@ gdb_test "ptype \"abc\"" " = char \\\[4\\\]"
 gdb_test "print \$cvar = \"abc\"" " = \"abc\""
 gdb_test "print sizeof (\$cvar)" " = 4"
 
+# GDB used to complete the explicit location options even when
+# printing expressions.
+gdb_test_no_output "complete p -function"
+gdb_test_no_output "complete p -line"
+gdb_test_no_output "complete p -source"
+
 gdb_file_cmd ${binfile}
 
 gdb_test "print \$pc" "No registers\\." "print \$pc (with file)"
@@ -950,7 +966,7 @@ gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
 gdb_load ${binfile}
 
 if ![runto_main] then {
-    fail "Can't run to main"
+    fail "can't run to main"
     return 0
 }
 
@@ -975,3 +991,4 @@ test_printf
 test_printf_with_dfp
 test_print_symbol
 test_repeat_bytes
+test_radices
This page took 0.027483 seconds and 4 git commands to generate.