public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* How to combine two GDB commands into one
@ 2021-09-28 10:24 周春明(日月)
  2021-09-28 21:18 ` Philippe Waroquiers
  0 siblings, 1 reply; 3+ messages in thread
From: 周春明(日月) @ 2021-09-28 10:24 UTC (permalink / raw)
  To: 周春明(日月),
	Simon Marchi, Gdb-patches, gdb-patches

Dear GDB experts,

I have a request, in some scene, I want to "set scheduler-locking on", then "next", then "scheduler-locking off",
Can I combine the three commands into one?

Thanks,
-Riyue

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to combine two GDB commands into one
  2021-09-28 10:24 How to combine two GDB commands into one 周春明(日月)
@ 2021-09-28 21:18 ` Philippe Waroquiers
  2021-09-28 21:34   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Waroquiers @ 2021-09-28 21:18 UTC (permalink / raw)
  To: 周春明(日月),
	Simon Marchi, Gdb-patches, gdb-patches

On Tue, 2021-09-28 at 18:24 +0800, 周春明(日月) via Gdb-patches wrote:
> Dear GDB experts,
> 
> I have a request, in some scene, I want to "set scheduler-locking on", then "next", then "scheduler-locking off",
> Can I combine the three commands into one?
> 
> Thanks,
> -Riyue

In your .gdbinit, something like:
  define schedlock-next
    set scheduler-locking on
    next
    set scheduler-locking off
  end

and then the newly defined schedlock-next command should do what you want.

See e.g. https://sourceware.org/gdb/current/onlinedocs/gdb/Sequences.html#Sequences
for more details.

You can also extend GDB using python or guile.

Philippe



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to combine two GDB commands into one
  2021-09-28 21:18 ` Philippe Waroquiers
@ 2021-09-28 21:34   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2021-09-28 21:34 UTC (permalink / raw)
  To: Philippe Waroquiers, 周春明(日月),
	Gdb-patches, gdb-patches

On 2021-09-28 17:18, Philippe Waroquiers wrote:
> On Tue, 2021-09-28 at 18:24 +0800, 周春明(日月) via Gdb-patches wrote:
>> Dear GDB experts,
>>
>> I have a request, in some scene, I want to "set scheduler-locking on", then "next", then "scheduler-locking off",
>> Can I combine the three commands into one?
>>
>> Thanks,
>> -Riyue
> 
> In your .gdbinit, something like:
>   define schedlock-next
>     set scheduler-locking on
>     next
>     set scheduler-locking off
>   end
> 
> and then the newly defined schedlock-next command should do what you want.
> 
> See e.g. https://sourceware.org/gdb/current/onlinedocs/gdb/Sequences.html#Sequences
> for more details.
> 
> You can also extend GDB using python or guile.

Not the original question, but why not use "set scheduler-locking step"?

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-28 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 10:24 How to combine two GDB commands into one 周春明(日月)
2021-09-28 21:18 ` Philippe Waroquiers
2021-09-28 21:34   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).