public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Recommend C source browser/editor?
@ 2021-08-06 20:25 Grant Edwards
  2021-08-07  7:20 ` n952162
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Grant Edwards @ 2021-08-06 20:25 UTC (permalink / raw
  To: gentoo-user

Would anybody care to recommend a tool for browsing around (and
editing) a tree of somebody-else's C code?

I prefer emacs for day-to-day editing of my code (when I know what's
where), but I'm looking for something to browse around a tree of
unfamiliar source code and make minor changes. I briefly tried
emacs+cscope at a few points in the past, but it just never worked
very well.

It would be nice to have something that I can just point at a tree of
source files and not to have to spend a lot of time setting up a
"project" or "workspace" or whatever...

Mostly I'd like to be able to:

 * Click on a function and list places from which it is called().

 * Click on a function call and goto it's definition.

I don't care at all about debugging. This is embedded, real-time code
for which a debugger is pretty useless.

It would be nice to be able configure a function key to run an
arbitrary shell command that will run a "make" to build a binary,
download the binary to the target hardware, and start it.

If it can parse gcc error messages from a "make" command, that would
be nice, but not required.

I run mostly a GTK based system (but usually have quite a few QT
libraries installed to support things like Wireshark).

Any suggestions?



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

* Re: [gentoo-user] Recommend C source browser/editor?
  2021-08-06 20:25 [gentoo-user] Recommend C source browser/editor? Grant Edwards
@ 2021-08-07  7:20 ` n952162
  2021-08-07  7:43 ` [gentoo-user] " Nikos Chantziaras
  2021-08-07  8:58 ` [gentoo-user] " Matthew Smith
  2 siblings, 0 replies; 4+ messages in thread
From: n952162 @ 2021-08-07  7:20 UTC (permalink / raw
  To: gentoo-user

On 8/6/21 10:25 PM, Grant Edwards wrote:
>
> Mostly I'd like to be able to:
>
>   * Click on a function and list places from which it is called().
>
>   * Click on a function call and goto it's definition.
>

Well, for me there's only vi.  The second requirement you get with
ctags. Works fantastic.

The first is handled by a simple tool that I developed, using a vi-macro
to invoke on a symbol ...

I could conjure it up from somewhere, but not today.

It will search a directory tree.  It doesn't use an index, but in my
experience, the performance was acceptable.

(there's cscope, of course, but I never really got to like that, for
some reason.  But check it out, it might be good for you)



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

* [gentoo-user] Re: Recommend C source browser/editor?
  2021-08-06 20:25 [gentoo-user] Recommend C source browser/editor? Grant Edwards
  2021-08-07  7:20 ` n952162
@ 2021-08-07  7:43 ` Nikos Chantziaras
  2021-08-07  8:58 ` [gentoo-user] " Matthew Smith
  2 siblings, 0 replies; 4+ messages in thread
From: Nikos Chantziaras @ 2021-08-07  7:43 UTC (permalink / raw
  To: gentoo-user

On 06/08/2021 23:25, Grant Edwards wrote:
> Would anybody care to recommend a tool for browsing around (and
> editing) a tree of somebody-else's C code?
> 
> I prefer emacs for day-to-day editing of my code (when I know what's
> where), but I'm looking for something to browse around a tree of
> unfamiliar source code and make minor changes. I briefly tried
> emacs+cscope at a few points in the past, but it just never worked
> very well.
> 
> It would be nice to have something that I can just point at a tree of
> source files and not to have to spend a lot of time setting up a
> "project" or "workspace" or whatever...

If emacs has support for compilation databases (a 
"compile_commands.json" file), then you can generate one. The easiest 
way to do that is with dev-util/bear:

   $ bear -- make -j16

This will build the project as usual, but a compile_commands.json file 
will be generated in the current directory. Load that file into an 
editor or IDE that supports compilation databases.



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

* Re: [gentoo-user] Recommend C source browser/editor?
  2021-08-06 20:25 [gentoo-user] Recommend C source browser/editor? Grant Edwards
  2021-08-07  7:20 ` n952162
  2021-08-07  7:43 ` [gentoo-user] " Nikos Chantziaras
@ 2021-08-07  8:58 ` Matthew Smith
  2 siblings, 0 replies; 4+ messages in thread
From: Matthew Smith @ 2021-08-07  8:58 UTC (permalink / raw
  To: gentoo-user

On Fri, 6 Aug 2021, at 20:25, Grant Edwards wrote:
> It would be nice to have something that I can just point at a tree of
> source files and not to have to spend a lot of time setting up a
> "project" or "workspace" or whatever...
> 
> Mostly I'd like to be able to:
> 
>  * Click on a function and list places from which it is called().
> 
>  * Click on a function call and goto it's definition.

You might like Sourcetrail (packaged as dev-cpp/sourcetrail).

If you have a bunch of projects to look at, you could set up Sourcegraph
(https://docs.sourcegraph.com/#quickstart-guide) on a server too.

Thanks,
Matthew


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

end of thread, other threads:[~2021-08-07  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-06 20:25 [gentoo-user] Recommend C source browser/editor? Grant Edwards
2021-08-07  7:20 ` n952162
2021-08-07  7:43 ` [gentoo-user] " Nikos Chantziaras
2021-08-07  8:58 ` [gentoo-user] " Matthew Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox