Re: [PATCH with testcase] Bug 11568 - delete thread-specific breakpoint on the thread exit

Tom Tromey
2013-08-05T13:57:26Z

>>>>> "Muhammad" == Muhammad Waqas <mwaqas@codesourcery.com> writes:

Muhammad> insertion_state_t;
Muhammad> +static void remove_threaded_breakpoints (struct thread_info *tp, int
Muhammad> silent);
Muhammad> +

Your patch got mangled by your mailer. This makes it hard to check the
formatting, so please fix that.

Muhammad> +static void
Muhammad> +remove_threaded_breakpoints(struct thread_info *tp, int silent)
Muhammad> +{

Needs an intro comment.

Muhammad> +
Muhammad> + if (b->thread > 0)
Muhammad> + {
Muhammad> + observer_attach_thread_exit (remove_threaded_breakpoints);
Muhammad> + }

It seems odd to re-register the observer each time.
Why not just do it once, at initialization time?

Muhammad> 2013-07-24 Muhammad Waqas <mwaqas@codesourccery.com>
Muhammad> Jan Kratochvil <jan.kartochvil@redhat.com>

Muhammad> PR gdb/11568
Muhammad> *gdb.thread/thread-specific-bp.c: Newfile.
Muhammad> *gdb.thread/thread-specific-bp.exp: Newfile.

Space after "*" and in "New file".

Muhammad> +set mode "All stop"
Muhammad> +
Muhammad> +if {[gdb_compile_pthreads \
Muhammad> + "${srcdir}/${subdir}/${srcfile}" \
Muhammad> + "${binfile}" executable {debug} ] != "" } {
Muhammad> + return -1
Muhammad> +}
Muhammad> +
Muhammad> +clean_restart ${binfile}
Muhammad> +
Muhammad> +proc check_threaded_breakpoint {} {
Muhammad> + global gdb_prompt mode

Make "mode" a parameter.
Use with_test_prefix, since otherwise the new .exp will have repeated
test names, an gdb anti-pattern.

Muhammad> +# Testing in non-stop+async mode.
Muhammad> +set mode "non-stop\\async"

It's better to simply not use an unusual character.

Tom