From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by sourceware.org (Postfix) with ESMTPS id 8F2F6384B406 for ; Wed, 3 Mar 2021 20:23:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F2F6384B406 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hi-angel@yandex.ru Received: from myt5-c20b1afdad56.qloud-c.yandex.net (myt5-c20b1afdad56.qloud-c.yandex.net [IPv6:2a02:6b8:c12:4325:0:640:c20b:1afd]) by forward103j.mail.yandex.net (Yandex) with ESMTP id A8C446740275; Wed, 3 Mar 2021 23:23:15 +0300 (MSK) Received: from myt5-aad1beefab42.qloud-c.yandex.net (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef]) by myt5-c20b1afdad56.qloud-c.yandex.net (mxback/Yandex) with ESMTP id vFGQzCat2X-NFImDu85; Wed, 03 Mar 2021 23:23:15 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1614802995; bh=A4oqxVhDek7besws5xt36sixbKdUiFDSfbmZjbyWFcg=; h=In-Reply-To:Cc:To:From:Subject:Message-ID:References:Date; b=lTT68Np+xPmn0PM+XYi7Fi6sK+WF3SYmqYbWrRbjr0YC0v8VHnThoehpCx0CLjRnC Syl+wwhk390193RuJmNSxBuyLT2hPlfTpcNyQrgxocff8u+49reCs/X4PeQqUkE/XO HEITDoU20PwYpjEeAoQLQZw5nhuYuKzxP7Z8sD6M= Authentication-Results: myt5-c20b1afdad56.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id KOV1QLaqS3-NFnuCGpw; Wed, 03 Mar 2021 23:23:15 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: <61f99c80b25f584bdcf0f03c271fd005a09757c4.camel@yandex.ru> Subject: Re: How to look up where a structure is defined? From: Konstantin Kharlamov To: Peng Yu Cc: libc-help Date: Wed, 03 Mar 2021 23:23:14 +0300 In-Reply-To: <998ef50db5faec782f174bd05394155a54830e11.camel@yandex.ru> References: <9f1dbafc6d1184d9ca07bdea98f696e0ca65b9e2.camel@yandex.ru> <998ef50db5faec782f174bd05394155a54830e11.camel@yandex.ru> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 20:23:28 -0000 On Wed, 2021-03-03 at 23:09 +0300, Konstantin Kharlamov wrote: > On Wed, 2021-03-03 at 13:51 -0600, Peng Yu wrote: > > This seems to be a complicated solution. I just want to get a database > > (a TSV file should be fine) of types and the header they appear. I > > don't want to build the project just to get this info. > > I see, well, the Universal Ctags I mentioned should work for you. It doesn't > require building the project: you just run `ctags -R` or `ctags -Re` (first > for > vim-style tags file, second one for emacs-style) over the repository, and you > get a `tags` or `TAGS` file with a list of definitions. > > Possible drawbacks on ctags I mentioned in the other email. Basically it's > that > it doesn't take context into consideration. > > Regarding usage: the tags file it generates, although can be read for human, > supposed to be read by text editors/IDEs. Since you mention a CSV file, I > assume > you might want something human-readable. Please see option --output-format= in > `man ctags` for details: I think you might want the `xref` format. (I never > tried it myself, just reading the man it seems like it what you're after). Although, I wouldn't hold my breath that reading a resulting xref file would be easy ☺ The reason being is that I expect a tags file created from glibc repo to be some hundreds of megabytes. For reference, a TAGS file I generated long ago for libreoffice project is sized at 183M. So yeah, you will probably want to use the file from an IDE or text editor, rather than reading it manually.