This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Displaced stepping just enable in non-stop mode


Fix a little bug in "displaced_step_non_step_doc.txt".

On Fri, Oct 10, 2008 at 11:37, teawater <teawater@gmail.com> wrote:
> Hi Pedro,
>
> Thanks for your example, I make a new patch for infrun.c and other for manual.
>
> 2008-10-10  Hui Zhu  <teawater@gmail.com>
>
>        Displaced stepping can be set to
>        auto (enable in non-stop mode), on, off.
>
>        * infrun.c (can_use_displaced_stepping): Change type to const
>        char pointer.
>        (can_use_displaced_stepping_auto): New string.
>        (can_use_displaced_stepping_on): New string.
>        (can_use_displaced_stepping_off): New string.
>        (can_use_displaced_stepping_enum): New array.
>        (show_can_use_displaced_stepping): In auto mode, also show the
>        current effect of the option.
>        (use_displaced_stepping): Return non-zero if displaced stepping
>        is auto, and can be used with GDBARCH, and in non-stop mode.
>        Return non-zero if displaced stepping is on, and can be used
>        with GDBARCH.
>        (_initialize_infrun): "can-use-displaced-stepping" function
>        change to add_setshow_enum_cmd.
>
> 2008-10-10  Hui Zhu  <teawater@gmail.com>
>
>        * gdb.texinfo (can-use-displaced-stepping) Describe the auto mode
>        setting, and make it the default.
>
>
> Thanks,
> Hui
>
> On Thu, Oct 9, 2008 at 22:49, Pedro Alves <pedro@codesourcery.com> wrote:
>> Hi,
>>
>> Thanks for doing this.
>>
>> On Wednesday 08 October 2008 07:10:43, teawater wrote:
>>
>>> -int can_use_displaced_stepping = 1;
>>> +const char can_use_displaced_stepping_auto[] = "auto";
>>> +const char can_use_displaced_stepping_on[] = "on";
>>> +const char can_use_displaced_stepping_off[] = "off";
>>> +const char *can_use_displaced_stepping_enum[] =
>>> +{
>>> +  can_use_displaced_stepping_auto,
>>> +  can_use_displaced_stepping_on,
>>> +  can_use_displaced_stepping_off,
>>> +  NULL,
>>> +};
>>> +const char *can_use_displaced_stepping = can_use_displaced_stepping_auto;
>>
>> Could you make these static while you're at it, please?  It was just missed
>> in the old boolean setting.
>>
>>>  static void
>>>  show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
>>>                                  struct cmd_list_element *c,
>>> @@ -567,12 +579,16 @@ Debugger's willingness to use displaced
>>>  "breakpoints is %s.\n"), value);
>>
>> Could you update this function to show what effect the auto setting
>> is currently having?  See breakpoint.c:show_always_inserted_mode for
>> an example.
>>
>>>  }
>>>
>>> -/* Return non-zero if displaced stepping is enabled, and can be used
>>> +/* Return non-zero if displaced stepping is auto, and can be used
>>> +   with GDBARCH, and in non-stop mode.
>>> +   Return non-zero if displaced stepping is on, and can be used
>>>     with GDBARCH.  */
>>>  static int
>>>  use_displaced_stepping (struct gdbarch *gdbarch)
>>>  {
>>> -  return (can_use_displaced_stepping
>>> +  return (((can_use_displaced_stepping == can_use_displaced_stepping_auto
>>> +           && non_stop)
>>> +          || can_use_displaced_stepping == can_use_displaced_stepping_on)
>>>           && gdbarch_displaced_step_copy_insn_p (gdbarch));
>>>  }
>>>
>>> @@ -4857,11 +4873,14 @@ function is skipped and the step command
>>>                            show_step_stop_if_no_debug,
>>>                            &setlist, &showlist);
>>>
>>> -  add_setshow_boolean_cmd ("can-use-displaced-stepping", class_maintenance,
>>> +  add_setshow_enum_cmd ("can-use-displaced-stepping", class_maintenance,
>>> +                          can_use_displaced_stepping_enum,
>>>                            &can_use_displaced_stepping, _("\
>>>  Set debugger's willingness to use displaced stepping."), _("\
>>>  Show debugger's willingness to use displaced stepping."), _("\
>>> -If zero, gdb will not use displaced stepping to step over\n\
>>> +If auto, gdb will auto use displaced stepping if it need (in non-stop mode).\n\
>>> +If on, gdb will use displaced stepping if such is supported by the target.\n\
>>> +If off, gdb will not use displaced stepping to step over\n\
>>>  breakpoints, even if such is supported by the target."),
>>
>> This also needs to be updated in the manual.  I'd suggest borrowing the text
>> from breakpoint.c's "always-inserted" command description to make it a
>> bit more descriptive, and mention which mode is the default.  Should mostly
>> be a matter of copy-paste, I think.
>>
>> --
>> Pedro Alves
>>
>

Attachment: displaced_step_non_step_doc.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]