Re: [PATCH] Skip gdb.base/break.exp catchpoint tests without catchpoints [PR34535]
Tom Tromey <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Rainer" == Rainer Orth <[email protected]> writes: Rainer> As detailed in PR PR testsuite/34535, the gdb.base/break.exp test FAILs Rainer> on Solaris: Thanks for the patch. Rainer> While this patch avoids the failure, I wonder if there's some document Rainer> on what it takes to actually implement catchpoints. There's not really docs on anything. However, most catchpoints are implemented in break-catch-*.c. Looking at break-catch-fork.c: int fork_catchpoint::insert_location (struct bp_location *bl) { if (is_vfork) return target_insert_vfork_catchpoint (inferior_ptid.pid ()); else return target_insert_fork_catchpoint (inferior_ptid.pid ()); } So basically the target has to implement the insert_fork_catchpoint target method; then arrange to tell gdb about TARGET_WAITKIND_FORKED when appropriate. Unfortunately the target methods don't have comments; while we try to add descriptions nowadays, in the past gdb was lax about this :( But there's a "paragraph" of them in target.h that you'd probably need to handle: virtual int insert_fork_catchpoint (int) TARGET_DEFAULT_RETURN (1); virtual int remove_fork_catchpoint (int) TARGET_DEFAULT_RETURN (1); virtual int insert_vfork_catchpoint (int) TARGET_DEFAULT_RETURN (1); virtual int remove_vfork_catchpoint (int) TARGET_DEFAULT_RETURN (1); virtual void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool) TARGET_DEFAULT_FUNC (default_follow_fork); Rainer> + set test "probe fork catchpoint" Rainer> + gdb_test_multiple "" $test { Rainer> + -re "Your system does not support this type.*" { Rainer> + unsupported $test Rainer> + } Rainer> + -re "$::gdb_prompt $" { Rainer> + set ::fork_catchpoints_supported 1 Rainer> + pass $test Rainer> + } Rainer> + } Rainer> +} Rainer> + if {!$::fork_catchpoints_supported} { Rainer> + return Rainer> + } Rainer> + Rainer> gdb_test "catch fork" "Catchpoint ${::decimal} \\(fork\\)" \ Rainer> "set catch fork, never expected to trigger" I think it would be better to just use gdb_test_multiple here, and if the "not supported" case is found, just return here. That would avoid starting another gdb. thanks, Tom