Frage

I want to write a GUI frontend to gdb, using MI. Currently I can communicate with gdb via pipe, but a GUI debugger should be able to display source code and allow users to check/modify data using thier mouse.

The question is, in order to know what variable the user is pointing at, I think I need to write a parser. However, I don't want to implement the whole lexer and parser things. How can I get the locations of those identifiers in the source code?

[EDIT]

In short, I want the user to be able to check the value of a variable by hover over the variable using mouse, so I have to parse the code to know where does each variable appear. I want to achieve functions like this: Taken from Visual Studio, value appears when hover on the var.

War es hilfreich?

Lösung

How can I get the locations of those identifiers in the source code?

... without writing a parser.

You can't. You would need to either write your own (for all programming languages your GUI will support), or hook one of the existing ones.

Clang makes it relatively easy to incorporate the C/C++ parser into a GUI, but ...

  • not everything can be parsed with Clang
  • this one aspect of writing a GUI is likely to be 100x more complicated than all the others, so perhaps not worth the effort.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top