[cfe-dev] How can I DeclarationName::dump() in eclipse?

Journeyer J. Joh oosaprogrammer at gmail.com
Thu Nov 1 00:28:49 PDT 2012


Hello list,

I am trying to debug Clang in Eclipse CDT recently.
But I cannot dump() an instance of clang::DeclarationName.

In SemaType.cpp, there is a global function, GetFullTypeForDeclarator().
In the global function, GetFullTypeForDeclarator(), there follows some
code below.

========================
  DeclarationName Name;
  if (D.getIdentifier())
    Name = D.getIdentifier();
========================

When gdb finished the code above, I tried to dump().

=============
p Name.dump()
=============

When I dumped like this in gdb it dumped the name. BUT,
When I dumped like this in eclipse gdb console, the name is NOT dumped!
To trouble-shoot this, I tried this way below.

==========================================================
/// errs() - This returns a reference to a raw_ostream for standard error.
/// Use it like: errs() << "foo" << "bar";
raw_ostream &llvm::errs() {
  // Set standard error to be unbuffered by default.
  static raw_fd_ostream S(/*STDERR_FILENO*/STDOUT_FILENO, /*false, true*/ true);
  return S;
}
==========================================================

This change makes llvm::errs() to be the same as llvm::outs()

BUT this didn't work also.

I wonder how I can make eclipse gdb console print the dump() of
clang::DeclarationName.


And a personal question to each individuals, what debugger or gdb
frontend do you use for debugging clang? ^^; I found eclipse the most
useful recently but this problem is now the bottle neck.


Thank you very much.
Sincerely
-- 
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------



More information about the cfe-dev mailing list