Monday, February 6, 2012

Kernel Debugging


[Ref: http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.kdb%2Fdoc%2Fkdb%2Fkdb.htm]
 
kdb command
This command is implemented as an ordinary user-space program and is typically used for
post-mortem analysis of a previously-crashed system by using a system dump file. The kdb command includes subcommands specific to the manipulation of system dumps.
 
KDB kernel debugger
- The KDB kernel debugger is integrated into the kernel and allows full control of the system while a debugging session is in progress. The KDB kernel debugger allows for traditional debugging tasks such as setting breakpoints and single-stepping through code.
- KDB needs to be enabled when the system boots.
- To check if the KDB is enabled or not, issue

$> bosdebug -L
Memory debugger           off
Memory sizes              0
Network memory sizes      0
Kernel debugger           off
Real Time Kernel          off
Backtracking fault log    on
Kernext Memory Tracking   off

- To create a kernel image with KDB enabled, issue
$> bosdebug -D 
This will turn on the kernel debugger. You need to bosboot and reboot in order to take this effect.
$> bosboot -a && reboot
[After of about 20-30 mins, you will have a KDB enabled image}
bosboot: Boot image is 49180 512 byte blocks.
- KDB enabled kernel image is ready. All you gotto do now is, reboot.
If you have HMC kinda machine (where you remotely try to reboot the machine), while booting, you can see Kernel Debugging is enabled.
$> reboot
 -------------------------------------------------------------------------------
                                Welcome to AIX.
                   boot image timestamp: 11:02:54 12/26/2011
                 The current time and date: 11:18:52 12/26/2011
        processor count: 1;  memory size: 2048MB;  kernel size: 28147575
         boot device: /vdevice/v-scsi@30000003/disk@8100000000000000:2
                       kernel debugger setting: enabled
-------------------------------------------------------------------------------
 


Tuesday, October 11, 2011

Sample vimrc file

set nocompatible

set backspace=indent,eol,start

set nobackup
set showcmd

set ts=3 sw=3 smarttab
set expandtab
set incsearch
set hlsearch
set nowrap

set cb=exclude:.*
syntax enable

source /opt/freeware/share/vim/vim71/syntax/syntax.vim
source /home/harishse/.vim/plugin/taglist.vim
source /home/harishse/.vim/plugin/comments.vim
source /home/harishse/.vim/plugin/supertab.vim
source /home/harishse/.vim/plugin/surround.vim
source /home/harishse/.vim/plugin/SearchComplete.vim
source /home/harishse/.vim/plugin/NERD_tree.vim
"Below lines are required if you want nerd tree to be opened automatically
"autocmd VimEnter * NERDTree
"autocmd BufEnter * NERDTreeMirror
"autocmd VimEnter * wincmd w

map <C-E> :NERDTree<cr>
map <C-P> :pwd<cr>
map <C-v><C-v> : vs<cr>
map <C-q> :q<cr>

let &t_Co=256
let &t_Sf="\<Esc>[3%dm"
let &t_Sb="\<Esc>[4%dm"

hi Search         cterm=bold       ctermfg=black
hi Constant       cterm=bold   ctermfg=red

set tabstop=4
set shiftwidth=4
set formatoptions+=r

set nu
set showmatch
set smartindent
filetype plugin on

Thursday, June 9, 2011

To find out the location of the missed calls you got

http://site3.way2sms.com/jsp/LocateMobile.jsp

Thursday, March 24, 2011

Socket Programming - Part 1

Reference: http://www.tenouk.com/cnlinuxsockettutorials.html

Port Numbers
  • 16 bit integers
  • So a maximum port numbers are 2^16 = 65536 (0 to 65535)
  • Unique with a machine/IP address
  • Each service/application/daemon will have their own port number 
  • Required to make a connection (along with its host IP address)
Server & Client Port Numbers
  • Connection is defined by: (Server IP and Port number) + (Client IP and port number)
  • Server Port numbers are low numbers in the range 1 - 1023 (called as WELL KNOWN PORT NUMBER)
  • Accessible only by Administrators (roots, in linux)
  • Used for authentication
  • A server running on a well-known port lets the OS know what port it wants to listen on
  • Normally, client port numbers are higher number starting at 1024
  • Client normally simples lets the OS picks a new port that is not already in use.

Monday, March 7, 2011

Background and Foreground Process

1. When you run a command (process), you can make it to run as a background process using $<cmd> &
2. If you forget to make that command as background, and if you feel you should do it now, then
- Press CTRL+Z (Suspend that process)
- $> bg disown 1 (make that process to be a background
3. Now if you want to check the list of background processes, type $> jobs
4. If you want to bring the background process to foreground, then type
$> fg %1
Again to make it a background process,
$> bg %1

Monday, February 7, 2011

When properties screwed up

When Properties got screwed up in Visual Studio 2005/2008, in the cmd, type "devenv /resetskippkgs".
It will get you the default properties (color, font etc) for your editor. 

Wednesday, August 25, 2010

Late/Dynamic Binding in C++






Late Binding using Function Pointers (C)

Tuesday, August 24, 2010

Locks in Multi-processing/multi-thread programming

DeadLock:
deadlock is a situation wherein two or more competing actions are each waiting for the other to finish, and thus neither ever does.


LiveLock:

livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing. Livelock is a special case of resource starvation; the general definition only states that a specific process is not progressing.
A real-world example of livelock occurs when two people meet in a narrow corridor, and each tries to be polite by moving aside to let the other pass, but they end up swaying from side to side without making any progress because they both repeatedly move the same way at the same time.
Livelock is a risk with some algorithms that detect and recover from deadlock. If more than one process takes action, the deadlock detection algorithm can repeatedly trigger. This can be avoided by ensuring that only one process (chosen randomly or by priority) takes action.

I2C protocol

http://www.i2cbus.com/theprotocol.html