Style and navigation in project question(?)

Tom Tromey tom@tromey.com
Fri Sep 7 22:34:00 GMT 2018


>>>>> ">" == kuba  <kuba@witominska.net> writes:

>> I'm new in this project and for beginning  I want to figure out how to fix
>> this bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23182

Hi.  We talked on irc but I figured that a reply on the list would also
be good for posterity.

>> 1. Trying to figure out what function can make problems I jump into print
>> and slowly go back. Reading code of those function I saw style problems
>> like
>>  int x;
>>  ...
>>  if (x) ...
>> or
>> if(a==b)
>>    /* it's ok to be a and b equal*/
>>    return a+b;
>> Is better to not touch them or add  !=0 or {}  as said in style documents?
>> (this one:
>> https://sourceware.org/gdb/wiki/Internals%20GDB-Testsuite-Coding-Standards

Normally existing code is just left as-is, unless you happen to be
touching that line.  Sometimes a reviewer might ask for a small change
in the context, but (I think) normally not -- though reindenting
something obviously wrong might be an exception.

>> 2. Its so big and I feel a bit lost. I found those  "print"  by luck and
>> guess. Is there any kind of map that can help me to find eg. actually
>> function that look for Fortran array, and try to print it? Or what
>> document I miss and should read?

gdb is a reasonably sized program and so one has to learn to navigate
it.  It is regular in its own way but this is not always written down.

Per-language code tends to be in files named after the language, so
ada-lang.c or rust-exp.y.  For Fortran the prefix is "f".  Convention
for most languages is that specialized printing code is in *-valprint,
so for Fortran array printing you want to start with f-valprint.c.

A language is defined by a structure in language.h.  So you can also
find most of the various callbacks by reading this structure and then
searching for instances of the structure.  This would take you to
f-lang.c:f_language_defn, which has a pointer to f_val_print -- the
primary entry point to Fortran value-printing.

There are other navigation rules like this.  Perhaps we could resurrect
that part of the old internals manual, if there was such a part, on the
wiki.

>> 3. It should be first question, but em I ask those two above in right place?

I don't understand this one, sorry, but you are welcome to ask questions
here or on irc.

Tom



More information about the Gdb mailing list