Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Variables view to show implementation class members?

Gdb sees type of variable as declared. If you want to access field that are in actual type you have to cast it.
Cast is available from context menu in variables view.

Elmenthaler, Jens wrote:
Hi all,

We are heavily making use of polymorphism. Using the debugger, the variables view shows the members of the declared class, not of the implemented. This doesn’t really help much.

However, using gdb in the console view, I can look into the implementation class, using the following command sequence:

set print object on

print expression

My question, is this a limitation of the gdb MI (-var-evaluate-expression seems to be used for the variables view), should the input be sent to the gdb folks instead?

Or could the CDT do it, e.g. gdb commands can be also sent to a gdb MI session?

Anyone working on that already?

Greetings, Jens.

Example:

#include <iostram>

using namespace std;

class Client {

public:

  virtual ~Client() {}

};

class SpecificClient : public Client {

public:

  virtual ~SpecificClient() {};

private:

  int mFive;

  string mText;

};

int main()

{

  Client *p = new SpecificClient;

  cerr << "Set break point here " << p << endl;

  return 0;

}

Set print object on

print *p

1329-interpreter-exec console "print *p"

~"$1 = (SpecificClient) {\n"

$1 = (SpecificClient) {

~"  <Client> = {\n"

  <Client> = {

~"    _vptr.Client = 0x400eb0\n"

    _vptr.Client = 0x400eb0

~"  }, \n"

  },

~"  members of SpecificClient: \n"

  members of SpecificClient:

~"  mFive = 0"

  mFive = 0~", \n"

,

~"  mText = {\n"

  mText = {

~"    static npos = 18446744073709551615"

    static npos = 18446744073709551615~", \n"

,

~"    _M_dataplus = {\n"

    _M_dataplus = {

~"      <std::allocator<char>> = {\n"

      <std::allocator<char>> = {

~" <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n"

<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},

~" members of std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider: \n"

members of std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider:

~"      _M_p = 0x3dfdcefe18 \"\""

      _M_p = 0x3dfdcefe18 ""~"\n"

~"    }"

    }~"\n"

~"  }"

  }~"\n"

~"}"

}~"\n"

Jens Elmenthaler
Platform & Components Lab

Architecture Development Team



Verigy Germany GmbH, Herrenberger Str. 130, 71034 Böblingen
Sitz der Gesellschaft: Böblingen - Amtsgericht Böblingen HRB 6167

WEEE-Reg.-Nr. DE 16968742
Geschäftsführer: Hans-Jürgen Wagner, Dietmar Höller

Tel: +49 7031 4357-119
j*ens.elmenthaler@xxxxxxxxxx* <mailto:jens.elmenthaler@xxxxxxxxxx>

------------------------------------------------------------------------

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
begin:vcard
fn:Elena Laskavaia
n:Laskavaia;Elena
tel;work:x2235
x-mozilla-html:FALSE
version:2.1
end:vcard


Back to the top