public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Calling class-methods in pascal (fpc)
@ 2011-09-19 19:47 Joost van der Sluis
  2011-10-05 18:04 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Joost van der Sluis @ 2011-09-19 19:47 UTC (permalink / raw)
  To: gdb; +Cc: Pierre Free Pascal

Hi all,

I've tried to call a method from a class in a pascal (fpc) application.
It didn't work when the language is set to Pascal. In that case it can't
find the method within the class definition. But when the language is
set to c++, it is possible to call the method.

What's happening is that in print_command_1() first parse_expression()
is called and thereafter evaluate_expression(). Now if lang=pascal,
parse_expression raises an error, because it doesn't recognize the
method as a member of the class-structure. (Because
lookup_struct_elt_type() does not check for nfn fields, but that's
beside the point)
But when lang=c++, parse_expression does not raise an exception, and
evaluate_expression does resolve the methodname. But even when the
class-member does not exist, parse_expression does not raise an
exception. The exception is raised in evaluate_expression.

Now to be able to fix this properly, I need to know what the function of
parse_expression() is compared to evaluate_expression()? To me it looks
like it that parse_expression is not needed at all.

Regards,

Joost van der Sluis.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Calling class-methods in pascal (fpc)
  2011-09-19 19:47 Calling class-methods in pascal (fpc) Joost van der Sluis
@ 2011-10-05 18:04 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2011-10-05 18:04 UTC (permalink / raw)
  To: Joost van der Sluis; +Cc: gdb, Pierre Free Pascal

>>>>> "Joost" == Joost van der Sluis <joost@cnoc.nl> writes:

I didn't see a response to this.

Joost> Now to be able to fix this properly, I need to know what the function of
Joost> parse_expression() is compared to evaluate_expression()? To me it looks
Joost> like it that parse_expression is not needed at all.

parse_expression parses a string and yields an expression object (struct
expression).

evaluate_expression evaluates a struct expression.

Basically you want this split so that you can parse some expressions
once, then evaluate them many times.  E.g., breakpoint conditions work
this way.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-05 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 19:47 Calling class-methods in pascal (fpc) Joost van der Sluis
2011-10-05 18:04 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).