Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Add new command to spit out the linetable for a given file
@ 2003-03-01  0:34 Joel Brobecker
  2003-03-01  2:05 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Joel Brobecker @ 2003-03-01  0:34 UTC (permalink / raw)
  To: gdb-patches

The GVD developpers have brought to my attention an issue regarding
mostly performance: GVD has a feature were it is capable of telling
whether a given line of a source file contains any code. In order to
do this, they use the "info line" command on every single line of the
file.

Obviously, this causes a lot of communication between GDB and GVD, so
they managed to improve a bit the performance by doing this operation as
a background task for the lines that are not currently displayed in the
editor (that is, without blocking the user from doing anything else).

In an effort to continue improving the performance even more, they asked
me if it was possible to add a new command that would print all in one
go the list of lines containing some code. 

In parallel, I know that GVD also provides an assembly view of the
current line of code. In order to get the addresses of the instructions
corresponding to the current line of code, the also use "info line".

So the idea that I came up with was to add a new function that would
essentially dump the linetable for the symtab of the file in question.
Roughly, from the user's perspective, it would be a new info command
(names can be improved):

        (gdb) info sloc <filename>
        0x1234    1
        0x1238    2
        0x1239    1
        0x123d    3
        ...

This shouldn't be too hard to implement, and should help GVD a lot.
What do you think? Any other idea, or is there any command I don't know
about that would give us this information?

-- 
Joel


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

* Re: [RFC] Add new command to spit out the linetable for a given file
  2003-03-01  0:34 [RFC] Add new command to spit out the linetable for a given file Joel Brobecker
@ 2003-03-01  2:05 ` Daniel Jacobowitz
  2003-03-01  8:18   ` Joel Brobecker
  2003-03-01 12:39 ` Eli Zaretskii
  2003-03-01 15:28 ` Andrew Cagney
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-03-01  2:05 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Fri, Feb 28, 2003 at 04:33:58PM -0800, Joel Brobecker wrote:
> The GVD developpers have brought to my attention an issue regarding
> mostly performance: GVD has a feature were it is capable of telling
> whether a given line of a source file contains any code. In order to
> do this, they use the "info line" command on every single line of the
> file.
> 
> Obviously, this causes a lot of communication between GDB and GVD, so
> they managed to improve a bit the performance by doing this operation as
> a background task for the lines that are not currently displayed in the
> editor (that is, without blocking the user from doing anything else).
> 
> In an effort to continue improving the performance even more, they asked
> me if it was possible to add a new command that would print all in one
> go the list of lines containing some code. 
> 
> In parallel, I know that GVD also provides an assembly view of the
> current line of code. In order to get the addresses of the instructions
> corresponding to the current line of code, the also use "info line".
> 
> So the idea that I came up with was to add a new function that would
> essentially dump the linetable for the symtab of the file in question.
> Roughly, from the user's perspective, it would be a new info command
> (names can be improved):

I believe that this command has been proposed before - I vaguely
remember it even being implemented but I don't know what happened to
the patch.  It was "maint info lines" or something similar...

Would be within the past year in the list archives somewhere but I
can't find it.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [RFC] Add new command to spit out the linetable for a given file
  2003-03-01  2:05 ` Daniel Jacobowitz
@ 2003-03-01  8:18   ` Joel Brobecker
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2003-03-01  8:18 UTC (permalink / raw)
  To: gdb-patches

> I believe that this command has been proposed before - I vaguely
> remember it even being implemented but I don't know what happened to
> the patch.  It was "maint info lines" or something similar...
> 
> Would be within the past year in the list archives somewhere but I
> can't find it.

Thanks Daniel, I think I found the message. I vaguely remembered this
too, but couldn't find it in the archives until you reminded me of the
proposed syntax.

   http://sources.redhat.com/ml/gdb-patches/2002-09/msg00084.html

This command is associating line numbers from PC addresses, or from
a range of addresses. The intent was to be able to generate a mixed
source/assembly view of the code. But the patch never got approved
because it was felt that this was not the best approach to solve this
problem, and because there is already a CLI command that does exactly
what the author needed (-data-disassemble).

What GVD needs is the opposite: get the PC addresses for each line of a
file. We could extend a bit the flexibility of this command by allowing
the user to specify a range of line numbers too, to allow a front-end to
limit the query to the lines currently visible in the source view, for
instance.

FernandoN made a very good point that "maint" commands are only intended
for debugging or testing GDB. That's why I chose to stay in the "info"
commands realm. I first thought about calling this command "info
linetable", but dropped this because of completion clashes with
the current "info line". So I came up with "info sloc", which I find
only so so, but was the best I could find.

We are not familiar with the GDB/MI commands yet, but if it is felt that
this new functionality would be more suitable if implemented as a MI
command, we would be happy to look into that too.

Let me know what you think. I believe this new command could be very
useful to all GDB frontends. Being able to tell at a glance which lines
have code is really a cool and helpful feature.

-- 
Joel


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

* Re: [RFC] Add new command to spit out the linetable for a given file
  2003-03-01  0:34 [RFC] Add new command to spit out the linetable for a given file Joel Brobecker
  2003-03-01  2:05 ` Daniel Jacobowitz
@ 2003-03-01 12:39 ` Eli Zaretskii
  2003-03-01 15:28 ` Andrew Cagney
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2003-03-01 12:39 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches

> Date: Fri, 28 Feb 2003 16:33:58 -0800
> From: Joel Brobecker <brobecker@gnat.com>
> 
>         (gdb) info sloc <filename>
>         0x1234    1
>         0x1238    2
>         0x1239    1
>         0x123d    3
>         ...
> 
> This shouldn't be too hard to implement, and should help GVD a lot.
> What do you think?

FWIW, I don't see anything wrong with adding such a command.

Please don't forget the appropriate doco patch if you do.


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

* Re: [RFC] Add new command to spit out the linetable for a given file
  2003-03-01  0:34 [RFC] Add new command to spit out the linetable for a given file Joel Brobecker
  2003-03-01  2:05 ` Daniel Jacobowitz
  2003-03-01 12:39 ` Eli Zaretskii
@ 2003-03-01 15:28 ` Andrew Cagney
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-03-01 15:28 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>         (gdb) info sloc <filename>
>         0x1234    1
>         0x1238    2
>         0x1239    1
>         0x123d    3
>         ...

Given that this is intended for use by GUI's, it would surely be better 
to add an MI command and then have legacy GUI's access it via the 
interps interface.

Andrew



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

end of thread, other threads:[~2003-03-01 15:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-01  0:34 [RFC] Add new command to spit out the linetable for a given file Joel Brobecker
2003-03-01  2:05 ` Daniel Jacobowitz
2003-03-01  8:18   ` Joel Brobecker
2003-03-01 12:39 ` Eli Zaretskii
2003-03-01 15:28 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox