semind(1)

πŸ’– semind(1) β€” Semantic Indexer for C πŸ’–

okay bestie, sit down, hydrate, and let me tell you about semind β€” it's the C semantic indexer from the General Commands Manual, and it's literally about to change your whole grep-until-you-cry lifestyle. πŸ¦‹


✨ NAME ✨

semind β€” Semantic Indexer for C. that's it, that's the name, short and iconic. πŸ‘‘


🌸 SYNOPSIS 🌸

semind [options]
semind [options] add [command options] [--] [compiler options] [files...]
semind [options] rm [command options] pattern
semind [options] search [command options] [pattern]
semind [options] search [command options] (-e|-l) filename:linenr:column

look at her go. five whole ways to run her. pick your fighter. πŸ’…


🫢 DESCRIPTION 🫢

so semind is the simple to use cscope-like tool built on top of sparse/dissect. bestie it's giving cscope but with ✨lore✨.

here's the tea though β€” unlike cscope, it runs after the pre-processor, which means it can't index the code that got filtered out by ifdef's 😭 (rip those branches, gone but not forgotten). but on the other hand?? otoh?? it actually understands how a symbol is used, and it can track the usage of struct members. not me being obsessed with a struct member tracker fr fr. πŸ”₯


πŸŽ€ SUBCOMMANDS πŸŽ€

  • add β€” generates or updates the semantic index file. she builds, she maintains, she slays. πŸ’–
  • rm β€” removes files from the index by pattern. the pattern is a glob(7) wildcard pattern. bye bestie πŸ‘‹
  • search β€” queries information about a symbol by pattern. the pattern is a glob(7) wildcard pattern. this is the main character moment honestly. πŸ”

πŸ’œ COMMON OPTIONS πŸ’œ

these work no matter which subcommand you're on. universal queen behavior. πŸ‘‘

  • -D, --database=FILE β€” specify the database file (default: ./semind.sqlite). yes she defaults to dropping a whole sqlite file right in your cwd, she's confident like that. πŸ’…
  • -v, --verbose β€” show information about what is being done. she'll narrate her own life. we love a transparent icon. πŸ—£οΈ
  • -h, --help β€” show this text and exit. classic, timeless, never not useful.

🌈 ADD OPTIONS 🌈

extra goodies for the add subcommand only.

  • --include-local-syms β€” include into the index local symbols. yes, the little local ones too. bring everybody to the party. πŸŽ‰

πŸ¦‹ SEARCH OPTIONS πŸ¦‹

the search subcommand's own little toolkit. πŸ’…

  • -f, --format=STRING β€” specify an output format. Default: (%m) %f\t%l\t%c\t%C\t%s (see FORMAT below). you can absolutely customize this, go off. ✨
  • -p, --path=PATTERN β€” search symbols only in specified directories. narrow that search down, stay focused bestie. 🎯
  • -m, --mode=MODE β€” search only the specified type of access (see MODE below). read? write? both? you decide. 😌
  • -k, --kind=KIND β€” specify a kind of symbol (see KIND below). functions? members? strict? pick one. πŸ’–
  • -e, --explain β€” Show what happens in the specified file position; πŸ‘€
  • -l, --location β€” Show usage of symbols from a specific file position; πŸ“
  • -v, --verbose β€” show information about what is being done; (yes she's here too, she gets around) πŸ—£οΈ
  • -h, --help β€” show this text and exit. always here for you. 🫢

⭐ FORMAT ⭐

these are the little placeholders you can drop into your --format string. mix and match, make it cute. ✨

  • %m β€” access mode in human readable form (see MODE below). πŸ’…
  • %f β€” file name. πŸ“
  • %l β€” line number. πŸ”’
  • %c β€” column number. πŸ“
  • %C β€” the name of the function in which the symbol occurs. 🧠
  • %n β€” symbol name. 🏷️
  • %s β€” source code line. heads up bestie: the indexer does not save source code lines β€” they're read from the file during the search. so if the file's gone, that line's gone. no cap. 😭

πŸ“ KIND πŸ“

the --kind values, short and sweet:

  • f β€” function
  • s β€” strict
  • m β€” struct member

🧚 MODE 🧚

okay so MODE gets dumped as a 3-letter string. and the letters mean:

  • the first letter denotes the address of part
  • the 2nd β€” access by value
  • the 3rd β€” access by pointer

and then there's a special value, 'def', which means a symbol definition. periodt. ✨

the actual mode letters:

  • r β€” read
  • w β€” write
  • m β€” read and write

πŸ’€ SEE ALSO πŸ’€

  • sparse(1) β€” her origin story, go read it. 🫢

πŸ‘‘ HOMEPAGE πŸ‘‘

https://sparse.docs.kernel.org β€” go touch grass (the documentation kind). 🌱


πŸ’Œ MAILING LIST πŸ’Œ

linux-sparse@vger.kernel.org β€” slide into the inbox, they don't bite. πŸ›


ok that's the whole page bestie, every flag, every letter, every default, all of it. go index something and feel powerful. πŸ’…βœ¨

and that's a wrap on the semind(1) page from the General Commands Manual β€” you've reached the end, mwah, bye bye, go forth and search. πŸŽ€πŸ¦‹πŸ’–