This is the mail archive of the gdb@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: Evaluating an expression in a given scope


On Wed, Sep 07, 2005 at 05:45:20PM +0400, Vladimir Prus wrote:
> Daniel Jacobowitz wrote:
> 
> > On Wed, Sep 07, 2005 at 04:39:52PM +0400, Vladimir Prus wrote:
> >> 
> >> Hello!
> >> 
> >> Does gdb provides a clean way to evaluate an expression in a given scope
> >> (file:line)?
> > 
> > No, not really.  File:line doesn't match unambiguously to scope,
> > either, so it's not clear what the interface should look like... I
> > think I'd use $pc instead.
> 
> You mean that variable can some into scope in the middle of assembler code
> for a source-language line? Say:
> 
>    int i = j, j = 10;
> 
> ? Well, true! Though it's really a corner case

No.  Think about inlining, template expansion, macro definitions with
line numbers (which gcc doesn't do today but could in the future).  A
line is not an unambiguous reference to GDB's notion of a "scope".

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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