public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
@ 2023-02-08 13:44 Simon Sobisch
  2023-02-09  7:00 ` Chris Packham
  2023-02-10 16:59 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Sobisch @ 2023-02-08 13:44 UTC (permalink / raw)
  To: GDB Mailing list

For "stepping in the current source" (given a mixed-source) I look for a 
way to "silent step" / "silent next".
This will be useful for example if you debug within Bison and/or Flex 
generated sources and don't want to step through the state / token 
machine, having only the Bison / Flex _source_ be visible.

Getting the source name from the frame and comparing this after a 
step/next is no big problem in GDB using python
    gdb.selected_frame().find_sal().symtab.fullname()

Using GDB in TUI mode I commonly "stay" in the source I'm interested in 
this way, but the GDB command line gets "flooded" with all the 
intermediate frame positions I'm not interested in.

So: is there a way to do a "step"/"next" with suppressing the normal 
output and mi stop events normally send?

Thank you for any pointers,
Simon

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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-08 13:44 Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)? Simon Sobisch
@ 2023-02-09  7:00 ` Chris Packham
  2023-02-09  8:36   ` Simon Sobisch
  2023-02-10 16:59 ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Packham @ 2023-02-09  7:00 UTC (permalink / raw)
  To: Simon Sobisch; +Cc: GDB Mailing list

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

On Thu, 9 Feb 2023, 2:44 AM Simon Sobisch via Gdb, <gdb@sourceware.org>
wrote:

> For "stepping in the current source" (given a mixed-source) I look for a
> way to "silent step" / "silent next".
> This will be useful for example if you debug within Bison and/or Flex
> generated sources and don't want to step through the state / token
> machine, having only the Bison / Flex _source_ be visible.
>
> Getting the source name from the frame and comparing this after a
> step/next is no big problem in GDB using python
>     gdb.selected_frame().find_sal().symtab.fullname()
>
> Using GDB in TUI mode I commonly "stay" in the source I'm interested in
> this way, but the GDB command line gets "flooded" with all the
> intermediate frame positions I'm not interested in.
>
> So: is there a way to do a "step"/"next" with suppressing the normal
> output and mi stop events normally send?
>
> Thank you for any pointers,
> Simon
>

Does the `skip` command do what you want? I use it for skipping
uninteresting things like memset() or printf() when stepping.

>

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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-09  7:00 ` Chris Packham
@ 2023-02-09  8:36   ` Simon Sobisch
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Sobisch @ 2023-02-09  8:36 UTC (permalink / raw)
  To: Chris Packham; +Cc: GDB Mailing list

Thank you for taking care!

When doing everything "manually" then 'skip' helps a lot - but the case 
is something like the following:

#line source.c 550
{
    int somevar;
#line source.y  12
    int interesting = some_call ();
#line source.c 560
    morecode();
    morecode_calling_code_in_source_y_at_line_55();
    morecode();
    morecode();
#line source.y 13
    another_call ();


the goal is to "step" from source.y line 12 into some_call(), but when 
returning back "stepping over" everything until we are "withing" 
morecode_calling_code_in_source_y_at_line_55 and when coming back reach 
another_call(), without knowing what code is between. It may consist of 
several lines or none, consist of several function code, inline 
assembler, ...

If done "automatically" with a defined command (in my case with python) 
then I can "see" that those lines are not part of "source.y" and can go 
on stepping, skipping would not be possible as the called functions may 
be in the same source, too.

The problem is that on each "step" there's an event that leads to the 
Debugger showing the source I'm not interested in.

Simon



Am 09.02.2023 um 08:00 schrieb Chris Packham:
> 
> 
> On Thu, 9 Feb 2023, 2:44 AM Simon Sobisch via Gdb, <gdb@sourceware.org 
> <mailto:gdb@sourceware.org>> wrote:
> 
>     For "stepping in the current source" (given a mixed-source) I look
>     for a
>     way to "silent step" / "silent next".
>     This will be useful for example if you debug within Bison and/or Flex
>     generated sources and don't want to step through the state / token
>     machine, having only the Bison / Flex _source_ be visible.
> 
>     Getting the source name from the frame and comparing this after a
>     step/next is no big problem in GDB using python
>          gdb.selected_frame().find_sal().symtab.fullname()
> 
>     Using GDB in TUI mode I commonly "stay" in the source I'm interested in
>     this way, but the GDB command line gets "flooded" with all the
>     intermediate frame positions I'm not interested in.
> 
>     So: is there a way to do a "step"/"next" with suppressing the normal
>     output and mi stop events normally send?
> 
>     Thank you for any pointers,
>     Simon
> 
> 
> Does the `skip` command do what you want? I use it for skipping 
> uninteresting things like memset() or printf() when stepping.
> 

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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-08 13:44 Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)? Simon Sobisch
  2023-02-09  7:00 ` Chris Packham
@ 2023-02-10 16:59 ` Tom Tromey
  2023-02-12 12:38   ` Philippe Waroquiers
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2023-02-10 16:59 UTC (permalink / raw)
  To: Simon Sobisch via Gdb; +Cc: Simon Sobisch

>>>>> "Simon" == Simon Sobisch via Gdb <gdb@sourceware.org> writes:

Simon> For "stepping in the current source" (given a mixed-source) I look for
Simon> a way to "silent step" / "silent next".
Simon> This will be useful for example if you debug within Bison and/or Flex
Simon> generated sources and don't want to step through the state / token
Simon> machine, having only the Bison / Flex _source_ be visible.

Simon> Getting the source name from the frame and comparing this after a
Simon> step/next is no big problem in GDB using python
Simon>    gdb.selected_frame().find_sal().symtab.fullname()

Simon> Using GDB in TUI mode I commonly "stay" in the source I'm interested
Simon> in this way, but the GDB command line gets "flooded" with all the
Simon> intermediate frame positions I'm not interested in.

Simon> So: is there a way to do a "step"/"next" with suppressing the normal
Simon> output and mi stop events normally send?

I don't think there is right now.  I think suppressing output during
these kinds of commands is a known issue, but nobody has looked into
what would be needed to fix it.

Tom

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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-10 16:59 ` Tom Tromey
@ 2023-02-12 12:38   ` Philippe Waroquiers
  2023-02-12 14:46     ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Waroquiers @ 2023-02-12 12:38 UTC (permalink / raw)
  To: Tom Tromey, Simon Sobisch via Gdb; +Cc: Simon Sobisch

As a (not very clean) bypass, you might do something like:
 alias silent-next = | next | grep -e some_regexp_to_see what_you_are_interested_in
and if you want to see nothing:
 alias silent-next = | next | cat > /dev/null

Philippe

On Fri, 2023-02-10 at 09:59 -0700, Tom Tromey wrote:
> > > > > > "Simon" == Simon Sobisch via Gdb <gdb@sourceware.org> writes:
> 
> Simon> For "stepping in the current source" (given a mixed-source) I look for
> Simon> a way to "silent step" / "silent next".
> Simon> This will be useful for example if you debug within Bison and/or Flex
> Simon> generated sources and don't want to step through the state / token
> Simon> machine, having only the Bison / Flex _source_ be visible.
> 
> Simon> Getting the source name from the frame and comparing this after a
> Simon> step/next is no big problem in GDB using python
> Simon>    gdb.selected_frame().find_sal().symtab.fullname()
> 
> Simon> Using GDB in TUI mode I commonly "stay" in the source I'm interested
> Simon> in this way, but the GDB command line gets "flooded" with all the
> Simon> intermediate frame positions I'm not interested in.
> 
> Simon> So: is there a way to do a "step"/"next" with suppressing the normal
> Simon> output and mi stop events normally send?
> 
> I don't think there is right now.  I think suppressing output during
> these kinds of commands is a known issue, but nobody has looked into
> what would be needed to fix it.
> 
> Tom



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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-12 12:38   ` Philippe Waroquiers
@ 2023-02-12 14:46     ` Tom Tromey
  2023-02-12 17:22       ` Philippe Waroquiers
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2023-02-12 14:46 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: Tom Tromey, Simon Sobisch via Gdb, Simon Sobisch

Philippe> As a (not very clean) bypass, you might do something like:
Philippe>  alias silent-next = | next | grep -e some_regexp_to_see what_you_are_interested_in
Philippe> and if you want to see nothing:
Philippe>  alias silent-next = | next | cat > /dev/null

I'm not completely sure but I think some of the inferior-control
commands work in a way that circumvents this.  At least, IIRC, there's a
bug open about not being able to capture this output using
gdb.execute(to_string=True).

Tom

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

* Re: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-12 14:46     ` Tom Tromey
@ 2023-02-12 17:22       ` Philippe Waroquiers
  2023-02-13  7:38         ` Aktemur, Tankut Baris
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Waroquiers @ 2023-02-12 17:22 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Simon Sobisch via Gdb, Simon Sobisch

At least some of the output is discarded:
(gdb) alias wwww = | next | cat > /dev/null
(gdb) n
33	  for (int i = 0; i < MAX/3; i++)
(gdb) wwww
(gdb) 

Philippe


On Sun, 2023-02-12 at 07:46 -0700, Tom Tromey wrote:
> Philippe> As a (not very clean) bypass, you might do something like:
> Philippe>  alias silent-next = | next | grep -e some_regexp_to_see what_you_are_interested_in
> Philippe> and if you want to see nothing:
> Philippe>  alias silent-next = | next | cat > /dev/null
> 
> I'm not completely sure but I think some of the inferior-control
> commands work in a way that circumvents this.  At least, IIRC, there's a
> bug open about not being able to capture this output using
> gdb.execute(to_string=True).
> 
> Tom



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

* RE: Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)?
  2023-02-12 17:22       ` Philippe Waroquiers
@ 2023-02-13  7:38         ` Aktemur, Tankut Baris
  0 siblings, 0 replies; 8+ messages in thread
From: Aktemur, Tankut Baris @ 2023-02-13  7:38 UTC (permalink / raw)
  To: gdb, Simon Sobisch; +Cc: Tom Tromey, Philippe Waroquiers

On Sunday, February 12, 2023 6:23 PM, Philippe Waroquiers wrote:
> At least some of the output is discarded:
> (gdb) alias wwww = | next | cat > /dev/null
> (gdb) n
> 33	  for (int i = 0; i < MAX/3; i++)
> (gdb) wwww
> (gdb)
> 
> Philippe
> 
> 
> On Sun, 2023-02-12 at 07:46 -0700, Tom Tromey wrote:
> > Philippe> As a (not very clean) bypass, you might do something like:
> > Philippe>  alias silent-next = | next | grep -e some_regexp_to_see
> what_you_are_interested_in
> > Philippe> and if you want to see nothing:
> > Philippe>  alias silent-next = | next | cat > /dev/null
> >
> > I'm not completely sure but I think some of the inferior-control
> > commands work in a way that circumvents this.  At least, IIRC, there's a
> > bug open about not being able to capture this output using
> > gdb.execute(to_string=True).
> >
> > Tom
> 

There is "set suppress-cli-notifications".  Does it satisfy the needs?

(gdb) set suppress-cli-notifications on
(gdb) step
(gdb) next
(gdb) next
(gdb) next
(gdb)


Regards,
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

end of thread, other threads:[~2023-02-13  7:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 13:44 Is there an option to "silent-step"/ "silent-next" (possibly in python and/or mi)? Simon Sobisch
2023-02-09  7:00 ` Chris Packham
2023-02-09  8:36   ` Simon Sobisch
2023-02-10 16:59 ` Tom Tromey
2023-02-12 12:38   ` Philippe Waroquiers
2023-02-12 14:46     ` Tom Tromey
2023-02-12 17:22       ` Philippe Waroquiers
2023-02-13  7:38         ` Aktemur, Tankut Baris

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).