GNU Pascal Homepage - gpc - gpc-announce - gpc-de - gpc-doc
Diese Seite auf deutsch

Mail #6308

Back to main page of archive

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  

From: levi@localhost.nc3a.nato.int
Subject: GDB scope does not work quite right for Pascal
Date: 12 Oct 2001, 18:57:32

Pierre Muller wrote:

> At 14:44 12/10/01 , vous avez écrit:
> 
>> >Number:         222
>> >Category:       gdb
>> >Synopsis:       GDB scope does not work quite right for Pascal
>> >Confidential:   no
>> >Severity:       non-critical
>> >Priority:       medium
>> >Responsible:    unassigned
>> >State:          open
>> >Class:          sw-bug
>> >Submitter-Id:   net
>> >Arrival-Date:   Fri Oct 12 05:48:01 PDT 2001
>> >Closed-Date:
>> >Last-Modified:
>> >Originator:     Adam Oldham
>> >Release:        gdb 20010813
>> >Organization:
>> >Environment:
>> Mandrake 8.1, Kernel 2.4.8, glibc 2.2, Intel Platform
>> >Description:
>> Source is compiled with FPC (Free Pascal Compiler).  This can happen 
>> with any source of pascal. 


and any pascal compiler: it happens also for gpc

 When you declare nested functions, gdb's 
>> scope does not allow the viewing of the variables that are from the 
>> parent function that should be within the scope.
>> >How-To-Repeat:
>> The simple program attached will produce the problem.  When compiled 
>> and run, the correct output is displayed, but if you run GDB on it, 
>> and break on function test2 and print out int1 which is a global 
>> variable for the function test1, you receive:
>> "No symbol "INT1" in current context."
> 
> 
>   There are several remarks to that bug report:
>   1) I don't know at all how nested functions work in C
> Are they allowed? 


AKAIK no, they are not allowed, and this is the root of the problem,
since gdb is written mainly by/for C programmers.

> Do they also use a paremt fram pushing method ?
> If yes, can locals from the calling function be found in C?
> Maybe someone from the gdb mailing list can answer that question.
> If this is already implemented for C its probably easier to just take
> the same method.
> 
>   2) There is a solution, I implemented it in the IDE for Free Pascal
> but it is rather complicated.
>   Let me try to explain this solution to everyone.
>   Nested functions in pascal get a hidden parameter that contains the
> frame pointer (ebp value for i386 cpu) of the calling function. This 
> allows the
> program to access correctly local variable of the function that called 
> the nested
> function. This value is searched in the backtrace at the location where
> the frame pointer are usually saved ( i.e. at offset 0 of the local ebp 
> value for i386)
> If we find the corresponding frame (which is not always the first frame 
> above the current one)
> then we can try if we find the unfound local symbol in that frame).
> 
>    To ease this search, I inserted a pseudo-parameter to the function 
> called
> parent_ebp (in lower case, while normal Free Pascal symbols are uppercased)
> that indicate the location of this parnt frame pointer.
> 
> 3)  As maintainer of the pascal language specific part of GDB,
> I am of course willing to introduce this into the gdb sources, but I would
> really like to get first some feedback from the gpc list.
>    Does gpc do anything about this calling frame hidden parameter ?
> Could we agree to use the same method for both compiler
> in order to get better support for Pascal ?

Do'nt know, only Peter or Franck probably can tell.

Previous mail   Next mail   Unformatted/full headers
Overview  10 days   Subject   Date   Thread   Author  


In reply to

Author Subject Date
Pierre Muller GDB scope does not work quite right for Pascal 12 Oct 2001, 17:17:59

Back to main page of archive


Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.

Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.


This page was created by Crystal 0.999 (Linux 2.4.27/i686).