From: Yao Qi <yao@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 4/4] hw watchpoints made multi-inferior
Date: Tue, 07 Dec 2010 05:02:00 -0000 [thread overview]
Message-ID: <4CFDBFC3.5000803@codesourcery.com> (raw)
In-Reply-To: <20101206111443.GE27176@host0.dyn.jankratochvil.net>
On 12/06/2010 07:14 PM, Jan Kratochvil wrote:
Here are some my cents, although I can't approve or reject this patch. :)
> gdb/
> 2010-12-06 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix watchpoints for multi-inferior.
> * breakpoint.c
> (update_watchpoint) <b->pspace != current_program_space>: New.
This changelog entry looks strange. You can describe what is this
change here, like,
* breakpoint.c (update_watchpoint): Return directly if
breakpoint's pspace is not current_program_space.
> * linux-nat.c (linux_nat_iterate_watchpoint_lwps): Fix
> iterate_over_lwps FILTER.
What is FILTER? Why capitalized?
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -1302,6 +1302,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
> if (!watchpoint_in_thread_scope (b))
> return;
>
> + if (b->pspace != current_program_space)
> + return;
> +
> /* We don't free locations. They are stored in bp_location array and
> update_global_locations will eventually delete them and remove
> breakpoints if needed. */
> @@ -1879,6 +1882,7 @@ insert_breakpoint_locations (void)
> int val = 0;
> int disabled_breaks = 0;
> int hw_breakpoint_error = 0;
> + struct program_space *saved_current_program_space = current_program_space;
>
> struct ui_file *tmp_error_stream = mem_fileopen ();
> struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream);
> @@ -1908,7 +1912,8 @@ insert_breakpoint_locations (void)
> if we aren't attached to any process yet, we should still
> insert breakpoints. */
> if (!gdbarch_has_global_breakpoints (target_gdbarch)
> - && ptid_equal (inferior_ptid, null_ptid))
> + && (ptid_equal (inferior_ptid, null_ptid)
> + || b->pspace != saved_current_program_space))
> continue;
Please add some comments here for this change. It is not that obvious
to understand without multi-inferior context.
> val = insert_bp_location (b, tmp_error_stream,
> @@ -8265,6 +8270,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty,
> b = set_raw_breakpoint_without_location (NULL, bp_type);
> set_breakpoint_number (internal, b);
> b->thread = thread;
> + b->pspace = current_program_space;
> b->disposition = disp_donttouch;
> b->exp = exp;
> b->exp_valid_block = exp_valid_block;
> @@ -9404,6 +9410,9 @@ update_global_location_list (int should_insert)
> int keep_in_target = 0;
> int removed = 0;
>
> + if (old_loc->pspace != current_program_space)
> + continue;
code indent problem? Put extra three spaces in front of "continue".
> +static void
> +i386_inferior_data_cleanup (struct inferior *inf, void *arg)
> +{
> + struct i386_inferior_data *inf_data = arg;
> +
> + xfree (inf_data);
> +}
> +
Can't we 'xfree (arg);' directly?
> @@ -1287,7 +1287,7 @@ linux_nat_iterate_watchpoint_lwps
> if (inf->pid == inferior_pid)
> {
> /* Standard mode. */
> - iterate_over_lwps (minus_one_ptid,
> + iterate_over_lwps (pid_to_ptid (inferior_pid),
> iterate_watchpoint_lwps_callback, &data);
Please add some comments to explain this change "minus_one_ptid ->
pid_to_ptid (inferior_pid)". This change is mentioned in changelog as
"Fix iterate_over_lwps FILTER", but it is still no enough, IMO.
> +
> +gdb_test "add-inferior" "Added inferior 2"
> +gdb_test "inferior 2" "witching to inferior 2 .*"
> +gdb_load $binfile
> +
> +if ![runto_main] {
Please add `perror "Couldn't run ${testfile}"'
> + return
> +}
--
Yao (é½å°§)
next prev parent reply other threads:[~2010-12-07 5:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 11:14 Jan Kratochvil
2010-12-07 5:02 ` Yao Qi [this message]
2010-12-11 5:16 ` [patch 3/4] " Jan Kratochvil
2010-12-12 8:05 ` Jan Kratochvil
2010-12-13 2:47 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CFDBFC3.5000803@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox