Mukesh Chauhan

Just another WordPress.com weblog

Show callstack from the C program

Dear all,

I am currently working to show call stack of the current thread from the code itself. For this purpose, I am analyzing StackWalk64 and CaptureStackBackTrace windows API. I will update the post once I get through it.

Though, external utilities can also be used. user dump of the process can be taken to see the call stack. Solaris (and linux) has pstack command which is very excellent utility.

Please leave a comment if you have more information regarding this.

July 27, 2011 Posted by | Programming | Leave a comment

coreadm – core file administration

Coreadm utility is used to set various options for generating core on Solaris system.

Sometimes, core file is not generated for a process which has setid bit enabled. Use following command to enable the core generation for such processes –

coreadm -e proc-setid

Please see here for more options to use with coreadm.

July 22, 2011 Posted by | Uncategorized | Leave a comment

Difference between paged pool and nonpaged pool memory

Windows divides the kernel mode address space into paged and nonpaged memory pools. The paged memory can be swapped out and nonpaged memory is never swapped out.

Device drivers are usually not paged. For example, interrupt routine must be in nonpaged memory because interrupt can occur anytime. Paged pool can be allocated and accessed at IRQL < DISPATCH_LEVEL.

For more information, please visit this blog.

July 14, 2011 Posted by | Uncategorized | , | Leave a comment

FSUTIL – Create a file of specified size

Windows utility “fsutil” can be used to create a file of certain size.

Fsutil file createnew

For example:

fsutil file createnew C:\file_100MB.dat 104857600
will create a 100MB file (104,857,600B = 100MB) named “file_100MB.dat” in C drive.

July 1, 2011 Posted by | Uncategorized | Leave a comment

Disable structure padding in C

Following is the way to disable structure padding using pragma in C.

#pragma pack(push, 1)
//Define your structure here
#pragma pack(pop)
//Structure padding is re enabled.

More information can be found at MSDN. GCC follows the same specifications.

July 1, 2011 Posted by | Uncategorized | Leave a comment

Watch out

Ever been in the situation where you want to run the command continuously without writing a shell script for it.

Watch is used to run a command to run at regular intervals. The basic syntax of the command is
Continue reading

July 1, 2011 Posted by | Uncategorized | Leave a comment