From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91773 invoked by alias); 7 Sep 2018 22:34:57 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 91467 invoked by uid 89); 7 Sep 2018 22:34:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=primary, sk:kuba@wi, D*witominska.net, U*kuba X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.49.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Sep 2018 22:34:55 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway20.websitewelcome.com (Postfix) with ESMTP id C5DD6400D4570 for ; Fri, 7 Sep 2018 17:34:53 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id yPKZf3I4MbXuJyPKrfN482; Fri, 07 Sep 2018 17:34:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2WubZqYIS6ic8e3cs+gnOTUIX4W/V4gSlawFcTLdSK8=; b=oqZQWtV4o32JsyefXSCANlHa7D qV1lPJ6HfAiszgIks/UawL4Eu434+a9DmJlvQuLsPYkHbOs49WpTm02cGve6Qg+RppNBN155wmwUV V3TV6PX5/+cpxcMHq/KUkUWl8; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:51570 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fyPKZ-001ydh-8p; Fri, 07 Sep 2018 17:34:23 -0500 From: Tom Tromey To: kuba@witominska.net Cc: gdb@sourceware.org Subject: Re: Style and navigation in project question(?) References: Date: Fri, 07 Sep 2018 22:34:00 -0000 In-Reply-To: (kuba@witominska.net's message of "Thu, 6 Sep 2018 14:21:06 +0200") Message-ID: <87in3huec1.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-09/txt/msg00015.txt.bz2 >>>>> ">" == kuba 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