How to look up where a structure is defined?

Peng Yu pengyu.ut@gmail.com
Wed Mar 3 23:21:01 GMT 2021


On Wed, Mar 3, 2021 at 5:10 PM Konstantin Kharlamov <hi-angel@yandex.ru> wrote:
>
> On Wed, 2021-03-03 at 17:04 -0600, Peng Yu wrote:
> > $ ctags --c-kinds=+p -R -o - | grep '^setsockopt\>'
> > setsockopt      sysdeps/unix/sysv/linux/setsockopt.c    /^setsockopt (int fd,
> > int level, int optname, const void *optval, socklen_t len)$/;"  f
> >
> > ctags can not recognize the following line because there is a __THROW
> > at the end. Is there any other walkaround?
> >
> > https://github.com/bminor/glibc/blob/21c3f4b5368686ade28d90d8c7d79c4c95c72c1b/socket/sys/socket.h#L215
>
> So, when I run ctags over that file locally, I do get the definition, see:
>
>      λ ctags --c-kinds=+p -o - socket.h | grep '^setsockopt\>'
>     setsockopt      socket.h        /^extern int setsockopt (int __fd, int __level, int __optname,$/;"      p       typeref:typename:int
>
> Do you perhaps happen to have some old version of ctags? Mine is:
>
>  λ ctags --version
> Universal Ctags 5.9.0(p5.9.20210110.0), Copyright (C) 2015 Universal Ctags Team
> Universal Ctags is derived from Exuberant Ctags.
> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>   Compiled: Jan 15 2021, 00:04:58
>   URL: https://ctags.io/
>   Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc

OK. I installed the same version of ctags. Now, it can find it. Thanks.

$ ctags --version
Universal Ctags 5.9.0(0071282), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Mar  3 2021, 17:15:45
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +iconv,
+option-directory, +xpath, +json, +interactive, +yaml,
+case-insensitive-filenames, +packcc
$ ctags --c-kinds=+p -o - socket.h | grep '^setsockopt\>'
setsockopt    socket.h    /^extern int setsockopt (int __fd, int
__level, int __optname,$/;"    p    typeref:typename:int

-- 
Regards,
Peng


More information about the Libc-help mailing list