This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc enumeration print support


On Mon, Nov 29, 2010 at 8:52 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> On Mon, Nov 29, 2010 at 06:53:19PM +0800, jovi zhang wrote:
>> Thanks for your reply.
>> you means that there don't have any built-in functionality for dump
>> data structure.
>> like __GCC_DUMP_STRUCTURE__(f_unit).
>>
>> we are both code programmer, we both know how it is boring for write
>> print field of a data structure on by one. :)
>>
>> I got this idea when I use gdb, gdb have command print, and it will
>> print data structure with field name. I think maybe gdb read symbolic
>> info of binary.
>
> gdb reads the DWARF debugging information, generated by gcc when asked
> with -g, and this information contains a lot of thing (including field
> names and offsets and source file positions).
>
>>
>> As you said, extending GCC is too ...
>
> It definitely could worth it, and GCC MELT would help a lot, if you
> deal with a large enough software to be heavily concerned. For
> example, if your software is half a million line of C or C++ source
> code, such an effort is definitely worthwhile, but it means at least
> several weeks of learning & experimentation about GCC.
>
>>
>> Actually I don't understand why GCC not support this useful
>> functionality? GCC compiler know detail of each data structure
>> definition.
>
> Because GCC is mostly a standard compliant language, and the feature
> you want would require a significant language extension.
>
>> or is there have any library provider this functionality?(like gdb
>> parse symbolic info)
>
> I don't think so. Maybe things like http://opencxx.sourceforge.net/
> might interest you.
>
> Is the code you are thinking of your own, or is it external code?
>
> And perhaps C or C++ is not the right language for you. Java or Common
> Lisp or perhaps Ocaml might suite you better.
>
> Cheers.
>
> --
> Basile STARYNKEVITCH Â Â Â Â http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mines, sont seulement les miennes} ***
>


Hi, gcc-help guys.
  I want to find some gcc built-in unctionality for dump data
structure, like __GCC_DUMP_STRUCTURE__(f_unit).
  so then no need for programmer to print all field of data
structure one by one.
  using gdb can dump data structure automatic, that because gdb read
DWARF info.
  I think you know what I means, I send this question to
gcc@gcc.gnu.org(they tell me to find answer in this mailing list here)

  So do there have any expert give me some clue on this? or any
method to get this?
  About gdb read DWARF info, is there have any library can used in
my program directly?

 ÂThanks very much for reading this email.

.jovi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]