[PATCH] gdb.c++/method.exp: xfail for missing const

Michael Elizabeth Chastain mec@shout.net
Mon Apr 8 11:32:00 GMT 2002


How about this for printing "this" in a const method?

It reports PASS if the required "const" is present.
It reports (XFAIL|FAIL) with "missing const" if required "const" is missing.
  XFAIL if stabs debugging format
  FAIL  if any other debugging format
It reports FAIL for any other output.

Michael C

===

# Check access to this pointer
#
# gcc versions up to 3.0.4 with -gstabs+ do not emit "const" indicators,
# so the output is "A *".  It should be "const A *" or "const A * const".

get_debug_format

send_gdb "print this\n"
gdb_expect {
  -re "\\$\[0-9\]* = \\(const (class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
    pass "print this in A::bar"
  }
  -re "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
    setup_xfail_format "stabs"
    fail "print this in A::bar (missing const)"
  }
  -re ".*$gdb_prompt $" { fail "print this in A::bar" }
  timeout { fail "(timeout) print this in A::bar" }
}



More information about the Gdb-patches mailing list