Linux kernel
GDB:
add-symbol-file <.o file> <address>
info line <*(func + offset)>
list <line no>
list *<ADDR> <--- list code for ADDR
disassemble <API> <--- Assembly for that API
disassemble /m ------ show assembly and code
--- Change the source directory
gdb>directory <new_dir_path>
gdb>set substitute-path <old path> <new dir path>
Find the length of main function:
readelf -s a.out | grep main
Git:
> git checkout master - checkout master branch
> git checkout <branch> - Checkout branch
> git checkout -b <branch> - create and checkout brnach
> git add -u :/ - add all files to staged area
> git commit -s
> git commit -s --amend -> Update top commit
> git push qca HEAD:refs/for/master - Push to Gerrit
> git rebase --iteractive <commit>^ - To brig lower commit to top and then updated it
- Then git rebase --continue
> git rebase qca/master - rebase the workspace
< repo sync -j8 -qc --no-tags
The problem is that you started working without creating a topic branch
with "repo start". If you don't do that, you'll be working on a detached
head and your changes won't be available after a sync.
To get your commits back, run "git reflog" to obtain the SHA-1 or
symbolic name of your most recent commit. It's probably the second line
of output (i.e. HEAD@{1}). Then you can run this to restore:
repo start mybranch .
git reset --hard HEAD@{1}
repo sync -l .
Git push - git push qca HEAD:refs/for/master
Rename file - git mv old_filename new_filename
Add new file - git add filename
> How to modify a specified commit
You can use git rebase, for example, if you want to modify back to commit bbc643cd, run
$ git rebase --interactive bbc643cd^
In the default editor, modify 'pick' to 'edit' in the line whose commit you want to modify. Make your changes
and then commit them with the same message you had before:
$ git commit --all --amend --no-edit
to modify the commit, and after that
$ git rebase --continue
to return back to the previous head commit.
> git checkout master - checkout master branch
> git checkout <branch> - Checkout branch
> git checkout -b <branch> - create and checkout brnach
> git add -u :/ - add all files to staged area
> git commit -s
> git commit -s --amend -> Update top commit
> git push qca HEAD:refs/for/master - Push to Gerrit
> git rebase --iteractive <commit>^ - To brig lower commit to top and then updated it
- Then git rebase --continue
> git rebase qca/master - rebase the workspace
> From TAG -
repo init -b refs/tags/<TAG> -u ssh://<git-path> -m versioned.xml
> git rest --hard <commit ID>
> git checkout <file> to undo the local changes
> git reset <file> HEAD^1 - to unstage during cherrypicking
repo init -b refs/tags/<tag> -u ssh://<git path> -m versioned.xml
VIM:
Jumping to the start and end of a code block
To jump to the beginning of a C code block (while, switch, if etc), use the [{ command.
To jump to the end of a C code block (while, switch, if etc), use the ]} command.
The above two commands will work from anywhere inside the code block.
To jump to the beginning of a parenthesis use the [( command.
To jump to the end of a parenthesis use the ]) command.
]c : - next difference
[c : - previous difference
do - diff obtain
dp - diff put
git difftool -t vimdiff
add-symbol-file <.o file> <address>
info line <*(func + offset)>
list <line no>
list *<ADDR> <--- list code for ADDR
disassemble <API> <--- Assembly for that API
disassemble /m ------ show assembly and code
--- Change the source directory
gdb>directory <new_dir_path>
gdb>set substitute-path <old path> <new dir path>
Find the length of main function:
readelf -s a.out | grep main
Git:
> git checkout master - checkout master branch
> git checkout <branch> - Checkout branch
> git checkout -b <branch> - create and checkout brnach
> git add -u :/ - add all files to staged area
> git commit -s
> git commit -s --amend -> Update top commit
> git push qca HEAD:refs/for/master - Push to Gerrit
> git rebase --iteractive <commit>^ - To brig lower commit to top and then updated it
- Then git rebase --continue
> git rebase qca/master - rebase the workspace
< repo sync -j8 -qc --no-tags
The problem is that you started working without creating a topic branch
with "repo start". If you don't do that, you'll be working on a detached
head and your changes won't be available after a sync.
To get your commits back, run "git reflog" to obtain the SHA-1 or
symbolic name of your most recent commit. It's probably the second line
of output (i.e. HEAD@{1}). Then you can run this to restore:
repo start mybranch .
git reset --hard HEAD@{1}
repo sync -l .
Git push - git push qca HEAD:refs/for/master
Rename file - git mv old_filename new_filename
Add new file - git add filename
> How to modify a specified commit
You can use git rebase, for example, if you want to modify back to commit bbc643cd, run
$ git rebase --interactive bbc643cd^
In the default editor, modify 'pick' to 'edit' in the line whose commit you want to modify. Make your changes
and then commit them with the same message you had before:
$ git commit --all --amend --no-edit
to modify the commit, and after that
$ git rebase --continue
to return back to the previous head commit.
> git checkout master - checkout master branch
> git checkout <branch> - Checkout branch
> git checkout -b <branch> - create and checkout brnach
> git add -u :/ - add all files to staged area
> git commit -s
> git commit -s --amend -> Update top commit
> git push qca HEAD:refs/for/master - Push to Gerrit
> git rebase --iteractive <commit>^ - To brig lower commit to top and then updated it
- Then git rebase --continue
> git rebase qca/master - rebase the workspace
> From TAG -
repo init -b refs/tags/<TAG> -u ssh://<git-path> -m versioned.xml
> git rest --hard <commit ID>
> git checkout <file> to undo the local changes
> git reset <file> HEAD^1 - to unstage during cherrypicking
repo init -b refs/tags/<tag> -u ssh://<git path> -m versioned.xml
VIM:
Jumping to the start and end of a code block
To jump to the beginning of a C code block (while, switch, if etc), use the [{ command.
To jump to the end of a C code block (while, switch, if etc), use the ]} command.
The above two commands will work from anywhere inside the code block.
To jump to the beginning of a parenthesis use the [( command.
To jump to the end of a parenthesis use the ]) command.
]c : - next difference
[c : - previous difference
do - diff obtain
dp - diff put
git difftool -t vimdiff
Comments
Post a Comment