fx.
fx.

Reputation: 1277

How to find the definition of a function or a class name using grep or find?

I am new to Linux development and I have to work with Mono project on Linux. I have the following function declaration:

static MonoString *ves_icall_System_MonoType_getFullName (MonoReflectionType *object, gboolean full_name,
                                   gboolean assembly_qualified)

{
    MonoDomain *domain = mono_object_domain (object);
    ...

I would like to find the definition of MonoReflectionType and the implementation of function mono_object_domain. How do I use grep and find to do this with two separate bash commands? Thank you in advance.

Upvotes: 1

Views: 2212

Answers (2)

holygeek
holygeek

Reputation: 16185

Grep and find can do it but I think they're no the best tool for it. You'd be better off using ctags: http://ctags.sourceforge.net/.

Do this from the top level directory of your project:

$ ctags -R *
$ vi -t MonoReflectionType

I hope you're familiar with vi though ;)

Upvotes: 9

Alok Save
Alok Save

Reputation: 206518

You should probably be using CTags because that is more easier.

I hope your purpose is to find the definition while examining code and analyzing, with CTags you will find it very easy.

Upvotes: 3

Related Questions