public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/26629] New: evaluate expression in a given context
@ 2020-09-16 20:35 trass3r at gmail dot com
  2020-09-16 20:38 ` [Bug exp/26629] " trass3r at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2020-09-16 20:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26629

            Bug ID: 26629
           Summary: evaluate expression in a given context
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: exp
          Assignee: unassigned at sourceware dot org
          Reporter: trass3r at gmail dot com
  Target Milestone: ---

https://github.com/microsoft/MIEngine/issues/197
Natvis type definitions (MS pretty-printers) work in the context of the current
object, e.g. given

class llvm::Type {
  enum TypeID {
  };
  unsigned IDAndSubclassData;
};

If you have an object of type llvm::Type the printer could contain an
expression like
(TypeID)(IDAndSubclassData & 0xFF)

But TypeID is only visible inside the class (usings disregarded).


Supporting normal members is doable as you can just inject the name of the
actual object (o->...) but for other members like types and typedefs there
seems to be no way to do with some C++-like syntax trick.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug exp/26629] evaluate expression in a given context
  2020-09-16 20:35 [Bug exp/26629] New: evaluate expression in a given context trass3r at gmail dot com
@ 2020-09-16 20:38 ` trass3r at gmail dot com
  2020-09-17 14:04 ` tromey at sourceware dot org
  2022-06-03 22:06 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2020-09-16 20:38 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26629

--- Comment #1 from trass3r <trass3r at gmail dot com> ---
> Supporting normal members is doable

That means trivial member access.
Even in the simple non-trivial example given above you'd already need to know
that the TypeID and IDAndSubclassData symbols are part of the class:

(TypeID)(IDAndSubclassData & 0xFF)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug exp/26629] evaluate expression in a given context
  2020-09-16 20:35 [Bug exp/26629] New: evaluate expression in a given context trass3r at gmail dot com
  2020-09-16 20:38 ` [Bug exp/26629] " trass3r at gmail dot com
@ 2020-09-17 14:04 ` tromey at sourceware dot org
  2022-06-03 22:06 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2020-09-17 14:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26629

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |tromey at sourceware dot org
   Last reconfirmed|                            |2020-09-17
     Ever confirmed|0                           |1

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I think there's some support for this internally, in that if
the inferior is stopped in a method, it will look for members
and types using their unqualified name.
So, perhaps this could be extended to let the scope be passed
in.  Then MI could be enhanced to let the user do this.

See c-exp.y:classify_inner_name, which does:

  yylval.ssym.sym = cp_lookup_nested_symbol (type, copy.c_str (), block,
                                             VAR_DOMAIN);

Here the block implies the scope.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug exp/26629] evaluate expression in a given context
  2020-09-16 20:35 [Bug exp/26629] New: evaluate expression in a given context trass3r at gmail dot com
  2020-09-16 20:38 ` [Bug exp/26629] " trass3r at gmail dot com
  2020-09-17 14:04 ` tromey at sourceware dot org
@ 2022-06-03 22:06 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2022-06-03 22:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26629

--- Comment #3 from trass3r <trass3r at gmail dot com> ---
Sounds reasonable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2022-06-03 22:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 20:35 [Bug exp/26629] New: evaluate expression in a given context trass3r at gmail dot com
2020-09-16 20:38 ` [Bug exp/26629] " trass3r at gmail dot com
2020-09-17 14:04 ` tromey at sourceware dot org
2022-06-03 22:06 ` trass3r at gmail dot com

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).