Sign in Join

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

Mailing lists / fpc-devel / 2010-12

difference between stabs and dwarf for "var param"

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Martin
I found that for:
   procedure Foo(var AVal1: integer);

The value for AVal is correctly shown with stabs, but not with dwarf. (See below).

Is this a bug, and is it worth a bug report?

Results below for fpc 2.4.2 (but same for trunk)
With GDB 7.2-1 on W32 (but similar with other recent gdb versions)

I understand that a var param is passed by ref (internally), but if Stabs can tell the debugger, to hide this, then shouldn't dwarf be able to do that too?
Or is dwarf showing the internal pointer intentionally?

If it is intention: Is there a way to distinguis between a user defined pointer (Aval1: PInteger) and the internal pointer (var AVal1: Integer) ?

2.4.2 / 7.2 / Stabs
Executing (Recurse-Count=1) queued= 0:
"TGDBMIDebuggerCommandEvaluate: AVal1" State=Pause PauseWaitState=0

> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression AVal1"

<< TCmdLineDebugger.ReadLn "^done,value="10""
<< TCmdLineDebugger.ReadLn "(gdb) "

> TCmdLineDebugger.SendCmdLn "ptype AVal1"

<< TCmdLineDebugger.ReadLn "&"ptype AVal1\n""
[Debugger] Log output: &"ptype AVal1\n"
<< TCmdLineDebugger.ReadLn "~"type = LONGINT\n""
<< TCmdLineDebugger.ReadLn "^done"
<< TCmdLineDebugger.ReadLn "(gdb) "
Exec done

2.4.2 / 7.2 / Dwarf
Executing (Recurse-Count=1) queued= 0:
"TGDBMIDebuggerCommandEvaluate: AVal1" State=Pause PauseWaitState=0

> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression AVal1"

<< TCmdLineDebugger.ReadLn "^done,value="@0x14cff34"" << TCmdLineDebugger.ReadLn "(gdb) "

> TCmdLineDebugger.SendCmdLn "ptype AVal1"

<< TCmdLineDebugger.ReadLn "&"ptype AVal1\n""
[Debugger] Log output: &"ptype AVal1\n"
<< TCmdLineDebugger.ReadLn "~"type = &LONGINT\n""
<< TCmdLineDebugger.ReadLn "^done"
<< TCmdLineDebugger.ReadLn "(gdb) "
Exec done

Reply by email

Jonas Maebe
to Martin
Martin wrote
I understand that a var param is passed by ref (internally), but if Stabs can tell the debugger, to hide this, then shouldn't dwarf be able to do that too? Or is dwarf showing the internal pointer intentionally?

GDB does not yet support the concept of "var" parameters in DWARF, so we currently encode them as C++-style reference parameters.

Jonas

Reply by email

Pierre Free Pascal
to Jonas Maebe

I even had to revert a patch inside GDB about this issue, see:

http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html after my accepted patch:
http://sourceware.org/ml/gdb-patches/2010-05/msg00258.html

It seems that
DW_AT_variable_parameter
is an informational attribute only, and as such should only be used for display, but the fact that it is a parameter that is passed by reference should still be mentioned.

If we issue both, then we should probably,
inside the pascal expression reader, hide the reference, so that the output is the same as for stabs.

Pierre Muller

as pascal language maintainer of GDB.

Show quoted text 23 lines
-----Message d'origine----- De : [mailto:fpc-devel- De la part de Jonas Maebe Envoyé : jeudi 9 décembre 2010 17:59 À : FPC developers' list Objet : Re: [fpc-devel] difference between stabs and dwarf for "var param" On 09 Dec 2010, at 17:40, Martin wrote: > I understand that a var param is passed by ref (internally), but if Stabs can tell the debugger, to hide this, then shouldn't dwarf be able to do that too? > Or is dwarf showing the internal pointer intentionally? GDB does not yet support the concept of "var" parameters in DWARF, so we currently encode them as C++-style reference parameters. Jonas_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Jonas Maebe
to Pierre Free Pascal
Pierre Free Pascal wrote 9 lines
It seems that DW_AT_variable_parameter is an informational attribute only, and as such should only be used for display, but the fact that it is a parameter that is passed by reference should still be mentioned. If we issue both, then we should probably, inside the pascal expression reader, hide the reference, so that the output is the same as for stabs.

I think that sounds like a good idea.

Jonas

Reply by email