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: [RFC/RFA?] Should break FILE:LINENO skip prologue?


Hi Eli,

I think this is a great improvement in terms of clarity. Thanks!


> -@item @var{filename}:@var{number}
> -Specifies line @var{number} in the source file @var{filename}.
> +@item @var{filename}:@var{linenum}
> +Specifies the line @var{linenum} in the source file @var{filename}.
>  
>  @item @var{function}
>  Specifies the line that begins the body of the function @var{function}.
> -For example: in C, this is the line with the open brace.
> +For example, in C, this is the line with the open brace.

This is actually not true. It's usually the first line of code
past the open brace.

> As a convenience, @value{GDBN} extends the semantics of
> +expressions used in locations to cover the situations that frequently
> +happen during debugging.

I was a little bit confused at first by this sentence, as I thought
that you were saying that all the forms you are describing later are
extensions, which as you explain for C/C++/etc is not the case.
At the same time, I found it pretty hard to try to do better. Perhaps
if we took a different approach and made a subsection that describe
expressions that return the address of a function, and why they are
useful, then maybe we would be able to unconfuse things. For instance:

    Breaking on the first instruction of a function:
    
    Inserting a breakpoint on a function will result as documented at ... in
    a breakpoint at the first line of code inside the body of that function.
    Instead, you might sometimes want to break on the very first instruction
    of that function, inside the function prologue. To do that, you should
    use the *address linespec syntax, where address is an expression valid
    in the current language that returns the address of your function.
    
    All languages provide a way of getting a function address from its name,
    either as a valid expression for that language, or as an extension to
    this language.  Here they are:
    
      - C/C++/etc...: function_name.
      - Pascal and M2: &function_name.
      - Ada: function_name'Address. &function_name can also be used as
        an extension.

Hope this helps :)

-- 
Joel


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