public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Style and navigation in project question(?)
@ 2018-09-06 12:21 kuba
  2018-09-07 22:34 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: kuba @ 2018-09-06 12:21 UTC (permalink / raw)
  To: gdb

Hi,
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
I already reproduce it and relay gdb print 'x' array wrong, but it's not a
main question.
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
)

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?

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Style and navigation in project question(?)
  2018-09-06 12:21 Style and navigation in project question(?) kuba
@ 2018-09-07 22:34 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2018-09-07 22:34 UTC (permalink / raw)
  To: kuba; +Cc: gdb

>>>>> ">" == 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-07 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 12:21 Style and navigation in project question(?) kuba
2018-09-07 22:34 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).