(gdb) break *0x972

Debugging, GNU± Linux and WebHosting and ... and ...

[Dev-tools configuration] Git difftool

By default in git, when you ask for the diff between the two commits (or the last commit and the current head, or any diff actually), it prints it in the console in a patch-compatible form:

diff --git a/capture.py b/capture.py
index 4fe884f..9fe6d0e 100644
--- a/capture.py
+++ b/capture.py
@@ -23,7 +23,8 @@ class FunctionFinishBreakpoint (gdb.Breakpoint):
     def stop(self):
         self.parent.fhit_internal += 1
         self.enabled = False
-        
+        num = gdb.selected_thread().num
+        print "{}#{} F-STOP in {}".format("|   "*(num-1), num, self.parent.__class__.__name__.replace("_", " ").replace(" Breakpoint", ""))
         fct_stop = self.parent.prepare_after(self.fct_data)

         filter_stop = self.parent.stop_after_filters(self.filter_params)

That's nice, but not necessarily the easiest way to compare two versions of a file. Instead of that, I prefer using meld and its graphical interface:

git config --global diff.tool meld
git config --global merge.tool meld
git config --global --add difftool.prompt false # don't ask for a confirmation before starting meld

Now use git difftool and git mergetool and you'll see your file comparison directly in meld! You can see the result in cat ~.gitconfig:

...
[diff]
    tool = meld
[merge]
    tool = meld
[difftool]
    prompt = false

Tuesday, December 09, 2014 - No comments

Publié dans :