RE: symbolic debug of loadable modules with kgdb light

Caz Yokoyama
2009-10-01T17:18:35Z

Hello Joel,
>> +set remote interrupt-sequence [Ctrl-C | BREAK | SysRq-g]
>You changed the user interface again, this is really frustrating.
Sorry for frustrating you. The reason I changed is the following words by
Eli.

>Please use the same conventions for these keys as in the portion you are
replacing. >For example, BREAK should be in caps and control-c should be
spelled Ctrl-C.

When interrupt sequence is controlled by remotebreak, the user does not need
to enter strings. On the other hand, s/he has to specify sequence name on
"set remote interrupt-sequence". In addition, the sequence name has to be
same on document and actual command. Therefore, I changed according to Eli.
Let me know what you want.
-caz
-----Original Message-----
From: Joel Brobecker [mailto:brobecker@adacore.com]
Sent: Thursday, October 01, 2009 9:34 AM
To: Caz Yokoyama
Cc: 'Eli Zaretskii'; pedro@codesourcery.com; gdb-patches@sourceware.org
Subject: Re: symbolic debug of loadable modules with kgdb light

Regarding testing, since you are modifying remote.c, you'll need to run
the testsuite using gdbserver. The testsuite needs to be run before
and after the patch, in order to compare the results. Normally, there
should be no regression. Directions on how to do that are explained at
http://sourceware.org/gdb/wiki/TestingGDB (see Testing gdbserver in a
native configuration). Please indicate when you submit patches that
you ran the testsuite, and that you found no regression.

> + * remote.c (interrupt_sequence_control_c)
> + (interrupt_sequence_break, interrupt_sequence_sysrq_g)
> + (interrupt_sequence_modes): New constants.
> + (interrupt_sequence_mode, interrupt_on_connect): New variable.
> + (show_interrupt_sequence): New function.
> + (set_remotebreak, show_remotebreak): New function.
> + (send_interrupt_sequence: New function.
> + (remote_start_remote): Call send_interrupt_sequence if
interrupt_on_connect.
> + (remote_stop_as): Call send_interrupt_sequence.
> + (_initialize_remote): Add interrupt-sequence and
interrupt-on-connect,
> + modify remotebreak to call set_remotebreak and show_remotebreak.

Just a few formatting nits left: The ChangeLog entries needs to be
indented using tabs. You're mixing spaces and tabs. You're missing
a closing parenthesis after send_interrupt_sequence and the line just
after is too long (maximum is 79 or 80 characters).

> +set remote interrupt-sequence [Ctrl-C | BREAK | SysRq-g]

You changed the user interface again, this is really fustrating.
Personally, I don't care anymore what names we use for these options
and I can see why you prefer them, but since we're changing them again,
please ask Daniel Jacobowitz and Pedro Alves, who are the major
maintainers and regular users of this code, whether they are OK
with your choices.

In the future, I would really appreciate if we agreed on the user
interface first, without considering code while doing that, and then
stay with what we've agreed on. Otherwise, things keep changing every
time I look at a patch, and we both waste valuable time.

That being said, we're getting there.

> +/* This boolean variable specifies whether interrupt_sequence is sent
> + to remote target when gdb starts. This is mostly needed when you debug
> + Linux kernel. Linux kernel expects BREAK g which is Magic SysRq for
> + connecting gdb. */

Formatting: 2 spaces after each of the 2 periods.

> @@ -8993,6 +9073,10 @@
> _initialize_remote (void)
> {
> struct remote_state *rs;
> + struct cmd_list_element *cmd;
> + /* I can't use the same string for lookup_cmd(). Cause segment fault.
*/
> + static char *_set_remotebreak_ = "remotebreak";
> + static char *_show_remotebreak_ = "remotebreak";

Try this instead:

char *cmd_name;

cmd_name = "remotebreak";
cmd = lookup_cmd (&cmd_name, setlist, "", -1, 1);
deprecate_cmd (cmd, "set remote interrupt-sequence");
cmd_name = "remotebreak";
cmd = lookup_cmd (&cmd_name, showlist, "", -1, 1);
deprecate_cmd (cmd, "show remote interrupt-sequence");

The reason why you're getting the SEGV is because lookup_cmd updates
the pointer your passing to point after the command name it has matched.

> - add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\
> -Set whether to send break if interrupted."), _("\
> -Show whether to send break if interrupted."), _("\
> + add_setshow_boolean_cmd ("remotebreak", class_obscure, &remote_break,
_("\
> +Deprecated. Use \"set remote interrupt-sequence [control-c|break]\"
instead."), _("\
> +Deprecated. Use \"show remote interrupt-sequence\" instead."), _("\

Please undo this part of the change. You do NOT need to update the command
documentation for "set/show remotebreak", since this is already taken care

--
Joel