aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/gdb.python/py-format-address.exp20
1 files changed, 18 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.python/py-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp
index 8e7cf47..ab8022c 100644
--- a/gdb/testsuite/gdb.python/py-format-address.exp
+++ b/gdb/testsuite/gdb.python/py-format-address.exp
@@ -40,7 +40,23 @@ if ![runto_main] {
# for the program space and architecture (these will be selected based
# on the current inferior).
set main_addr [get_hexadecimal_valueof "&main" "UNKNOWN"]
-set next_addr [format 0x%x [expr $main_addr + 1]]
+require {!string equal $main_addr {UNKNOWN}}
+
+set next_addr "UNKNOWN"
+gdb_test_multiple "info break 1" "" {
+ -re -wrap " y +($hex) +in .*" {
+ set next_addr $expect_out(1,string)
+ set next_addr [regsub {^0x0+} $next_addr "0x"]
+ pass $gdb_test_name
+ }
+}
+if { $next_addr == "UNKNOWN" || $next_addr == $main_addr } {
+ set next_addr [format 0x%x [expr $main_addr + 1]]
+}
+
+verbose -log "main_addr: $main_addr"
+verbose -log "next_addr: $next_addr"
+
foreach_with_prefix symbol_filename { on off } {
gdb_test_no_output "set print symbol-filename ${symbol_filename}"
@@ -56,7 +72,7 @@ foreach_with_prefix symbol_filename { on off } {
"gdb.format_address, result should have no offset"
gdb_test "python print(\"Got: \" + gdb.format_address($next_addr))" \
- "Got: $next_addr <main\\+1${filename_pattern}>" \
+ "Got: $next_addr <main\\+$decimal${filename_pattern}>" \
"gdb.format_address, result should have an offset"
}