Monday, December 30, 2024

A Guide to Reverse Engineering a Code Base

Starting with https://github.com/StefanSchippers/xschem/issues/266

I just...saw that the top bar had "File", "Edit", "View" etc in there as plain text, so I assumed it must be hard-coded somewhere in the codebase. There's a tool in Unix-based systems called "fzf" or "fuzzy finder", you can use that to search for text or regex patterns in a large codebase, and I used that. After that I only had had to read a little bit about how to edit .tcl scripts from Google.

Turns out - fzf is the real deal. Well done Junegunn Choi.

An fzf fan : find anything you want with fzf.


All that being said, how you get to this code insertion is beyond me. Age showing obviously :) Or I'm just not a software junkie :)

# modified binding for button-1 clicks on menubuttons. Clicking on posted menu will unpost it
proc tk::menubutton1 {w x y} {
    # puts $w
    # puts "--> [array get tk::Priv] "
    if {[winfo ismapped [$w cget -menu ]]} {
      MenuUnpost {}
      return
    }
    if {$tk::Priv(inMenubutton) ne ""} {
tk::MbPost $tk::Priv(inMenubutton) $x $y
    }
}

bind Menubutton <Button-1> {tk::menubutton1 %W %X %Y}

# activate menus when hovering the mouse, even without button pressed
bind Menubutton <Motion> { tk::MbMotion %W down %X %Y} 


 
How to tell fzf to use batcat (that is, "bat" doesn't exist and gives you /bin/bash bat: command not found:

export FZF_DEFAULT_OPTS="--preview 'batcat --style=numbers --color=always {} || cat {}'"
# in your ~/.bashrc


No comments:

Post a Comment

Who Needs Cadence Anymore (for Schematic Tree Reporting that is :)? Make Your Own Reporter with chatGPT!

You know what I mean, if you've used Cadence - the SHIFT-T thing that gives you the schematic tree can be VERY useful, at times. No Cade...