Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-11

FPC debug information

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

dmitry boyarintsev

Hello

What debug information FP-compiler generates? To make proper expression evaluation, debugger should be aware of properties, otherwise result of the lines like this:

i := Memo1.Lines.Count; // there Lines and Count are properties

cannot be evaluated.

Reply by email

Jonas Maebe
to dmitry boyarintsev
dmitry boyarintsev wrote
What debug information FP-compiler generates?

Stabs or Dwarf.

Show quoted text 8 lines
To make proper expression evaluation, debugger should be aware of properties, otherwise result of the lines like this: i := Memo1.Lines.Count; // there Lines and Count are properties cannot be evaluated.

It is impossible to encode properties in stabs. In Dwarf you can in theory describe pretty much anything, but gdb does not yet support the full Dwarf specifications. I guess it would be possible already to add debug info for properties that simply map directly to a field, but other than that I'm not sure if there's much we can do at this point.

Jonas

Reply by email

dmitry boyarintsev
to Jonas Maebe
Show quoted text 7 lines
It is impossible to encode properties in stabs. In Dwarf you can in theory describe pretty much anything, but gdb does not yet support the full Dwarf specifications. I guess it would be possible already to add debug info for properties that simply map directly to a field, but other than that I'm not sure if there's much we can do at this point. property can also be read as function, is it possible to add pointer to the

functions, as well?
so i guess with no data about properties, in debug info, debugger should rely on available sources?

Reply by email

dmitry boyarintsev
to dmitry boyarintsev

another question about debug information:

while debugging with gdb, i have found that object methods are 'mapped' to the debugger (or debug information?) as functions with additional parameter 'self' (what they actually are),

so let's say, i have an object m: TMyObject with method procedure MyMethod;

while gdb, does not understand the syntax, m.MyMethod, method still can be called with TMYOBJECT_MYMETHOD(m) call.

can name collission to happen? if i also have function in the code, named like procedure TMyObject_MyMethod(a: TMyObject), so it's name would match (?) for the debugger with MyMethod ?

I hope my question is clear :)

------ Here's the code

type
  TMyObject = class
  public
  procedure MyMethod;
  end;
procedure TMyObject.MyMethod;
begin
  writeln('My method object');
end;
procedure TMyObject_MyMethod(m: TMyObject);
begin
  writeln(m.ClassName);
end;
procedure TMyObject__MyMethod(m: TMyObject);
begin
  writeln(m.ClassName, ' **');
end;
var
  m : TMyObject;
begin
  m := TMyObject.Create;
  m.MyMethod;
  TMyObject_MyMethod(m);
  m.Free;
end.

------ Here's the debugger output

(gdb) info functions
All defined functions:

File main6.pas:
void PASCALMAIN(void);
void TMYOBJECT_MYMETHOD(TMYOBJECT);
void TMYOBJECT__MYMETHOD(TMYOBJECT);  // TMyObject method?
void TMYOBJECT__MYMETHOD(TMYOBJECT);  // TMyObject method?

------

is there anyway for debugger to understand which of the procedures is actually TMyObject method?

Thanks.

Reply by email

Marc Weustink
to dmitry boyarintsev: functions, as well? so i guess with no data about properties, in debug info, debugger…
dmitry boyarintsev wrote 12 lines
It is impossible to encode properties in stabs. In Dwarf you can in theory describe pretty much anything, but gdb does not yet support the full Dwarf specifications. I guess it would be possible already to add debug info for properties that simply map directly to a field, but other than that I'm not sure if there's much we can do at this point. property can also be read as function, is it possible to add pointer to the functions, as well?

A property is not only reading but might be writing also (or only).

Marc

Reply by email

dmitry boyarintsev
to Marc Weustink

i know Marc, but the purpose is to make expression evaluation.

while setting property is procedure, i can't think of any expression that uses it. But of couse, it might be usefull to know how to set properties (directly member of class, or a method)

i guess, that property information is also available at .ppu files

Reply by email

Marc Weustink
to dmitry boyarintsev
dmitry boyarintsev wrote 7 lines
i know Marc, but the purpose is to make expression evaluation. while setting property is procedure, i can't think of any expression that uses it. But of couse, it might be usefull to know how to set properties (directly member of class, or a method) i guess, that property information is also available at .ppu files

Unfortunately, a debugger doesn't have that information.

Marc

Reply by email