Skip to main content

Posts

Showing posts from May, 2008

Kernel (for 2.6) debugging- kgdb

Kernel (for 2.6) debugging- kgdb &kgdb is a kernel patch that, once applied, allows for the use of the familiar gdb interface for source-level debugging of a running Linux kernel. The kgdb patch supplies the kernel with a debugging stub. This stub uses gdb remote serial/Ethernet protocol to communicate with gdb (host machine). This patch is applied to the kernel on the machine that will run the gdb session (host machine).The gdbmod for module debugging, gdbmod version of gdb is required to debug modules that are loaded dynamically on to the testing machine.Configuring kgdb Download kgdb and gdbmod patch for your kernel version from http://kgdb.linsyssoft.com/downloads.htmCopy the patch to the kernel source directory on the development machine, and apply, Unzip the kgdb patch
mkdir ${BASE_DIR}/patch-kgdb
cd ${BASE_DIR}/patch-kgdb
tar -jxvf linux-2.6.7-kgdb-2.2.tar.bz2 patch -p1 < ${BASE_DIR}/patch-kgdb/core-lite.patchpatch -p1 < ${BASE_DIR}/patch-kgdb/i386-lite.…

Kernel (for 2.6) debugging or module debugging

Kernel (for 2.6) debugging or module debugging kgdb is a kernel patch that, once applied, allows for the use of the familiar gdb interface for source-level debugging of a running Linux kernel. The kgdb patch supplies the kernel with a debugging stub. This stub uses gdb remote serial/Ethernet protocol to communicate with gdb (host machine). This patch is applied to the kernel on the machine that will run the gdb session (host machine).The gdbmod for module debugging, gdbmod version of gdb is required to debug modules that are loaded dynamically on to the testing machine.Download kgdb and gdbmod patch from:http://kgdb.linsyssoft.com/downloads.htmhttp://www.linuxjournal.com/article/4525ReferenceGdb quick ref guide. http://users.ece.utexas.edu/~adnan/gdb-refcard.pdfSimple how to http://www.shakthimaan.com/downloads/glv/kgdb-howto/kgdb-howto.html

c language links

http://cboard.cprogramming.com/showthread.php?t=103471

http://www.advancedlinuxprogramming.com/downloads.html

http://www.comeaucomputing.com/booklist/

http://www.howstuffworks.com/c.htm

http://www.eskimo.com/~scs/cclass/cclass.html

http://cslibrary.stanford.edu/102/

http://publications.gbdirect.co.uk/c_book/

Insight debugger making it work under windows for remote debugging- ARM target

Insight debugger another option This tool looks promising as can run from windows environment. Have more options than DDD, like setting up remote target through GUI. Getting started Compile Insight to run on windows environment, Insight can be compiled for windows or linux environment, For compilation under windows environment one needs either cygwin or minGw. I have used cygwin. Packages needed to compile insight are ·gcc, ·binutils·Insight·NewLibDownload cygwin from http://www.cygwin.com/This downloads setup.exe to your system.Save it and run setup, it will ask for packages to download, select the appropriate tools or install default packages for now. Note: While upgrading remove all reference to cygwin1.dll from cygwin directory and keep only latest one reference which will be available in x:\cygwin\bin, where x is dir in which cygwin is installed. Check this link for installation details http://classes.cs.kent.edu/sce/installcygwin.html#setupThere are two ways to get insight work …

c++ text book and some good resources

TextbooksData Structures with C++ Using STL, 2nd edition
Ford and Topp, Prentice Hall Accelerated C++
Koenig and Moo, Addison-Wesley These books are recommended only. The course will follow primarily the order of the Ford and Topp book, which is available at the bookstore. Some of the lectures are based on material in Koenig and Moo. Students should have available a C++ reference book, such as those by Malik or Stroustrop, and use on-line reference material. Web Resources There are also two very good websites you should find helpful: http://www.sgi.com/tech/stl/
The STL (standard template library) programmer's guide at SGI is a good resource for questions about vectors, lists, maps, etc. http://www.parashift.com/c++-faq-lite/
This is an organized summary of the most important FAQ's that have appeared on the C++ newsgroups. Both beginning and advanced students can benefit from it. Feel free to search for and share other web resources. Drop in Tutoring In addition to…

C++ Development toolset

Cygwin You probably already have Cygwin on your laptop as part of the RCS default installation. What is it? It's a UNIX environment for the Windows Operating System. You can do all of your work for this class using Cygwin, g++, and a text editor such as Emacs (in other words, you don't need to use Visual Studio). Read more about Cygwin here: Cygwin Tutorial from CSCI-1100 Computer Science I http://www.cygwin.com/Emacs on Windows For those of you interested in running the Emacs text editor on your Windows OS, you can download the binaries and access documentation here: ftp://ftp.gnu.org/gnu/windows/emacs/emacs-21.3-fullbin-i386.tar.gz http://www.gnu.org/software/emacs/windows/ntemacs.html Dev C++ Here's a free shareware (GNU General Public License) C++ development environment that can be used with the gcc compilers. The environment is similar to Visual Studio and is a good option for this class. http://www.bloodshed.net/devcpp.htmlMinGW (Minimalistic GNU …

drag and drop data/files from windows to linux

copy from windows to linux in simple way
drag and drop data/files from windows to linuxI was struggling to get the files from windows to Linux machine. well there are number of ways to do that, here I am sharing a very simple way -ie drag and drop data/files from windows to Linux, that can be used by non-techie person also. 1. To get files from windows X machine to Linux Y machine, you need to know IP address of Linux machine. Assuming that you have write permission on Linux machine. 2. Now you are ready with files to copy on Linux Y machine, open my-computer , go to address bar and type ftp://198.168.200.200 this is Linux Y machine's IP address. Press enter. 3. You will not see any data here, right click and you can see login as, login with user name and password. or same can be found at, go to file login as and login to linux Y machine. 4. once you are login select the folder where you want to drag and drop the files from windows machine.5. Now Drag files from windows machine and…

Remote debugging for ARM target board

Remote debugging for ARM target boardWith GDB one can both trace and modify code and data flow, and otherwise analyze the behavior of code, without explicitly changing any of it.Rather than run a full-blown instance of GDB on the target platform, you can use GDBserver, a program that lets you run GDB on a different machine than the one on which your program is running. The advantage of using GDBserver is that it needs just a fraction of the target resources that GDB consumes, because it implements only the low-level functionality of the debugger -- namely setting breakpoints and accessing the target processor registers and read/write application memory. GDBserver takes control of the application being debugged, and then waits for instructions from a remote instance of GDB running on a development workstation.Remote target needs to have debugging stub (gdbserver),
The gdbserver is also referred to as the 'stub' and must be cross-compiled for
that target. You also have to use a ve…

count the number of ones in a 32

#include
#include
/*no. of 1's in no. of 1's steps*/
int count(unsigned long int n)
{
int count=0;
while(n)
{
count++;
n=n&n-1;
}
return count ;
}


/* This is a table which will contain number of ones
corrosponding to number value */
static int bits_in_char [256] ;

int bitcount (unsigned int n)
{
// works only for 32-bit ints

return bits_in_char [n & 0xffu]
+ bits_in_char [(n >> 8) & 0xffu]
+ bits_in_char [(n >> 16) & 0xffu]
+ bits_in_char [(n >> 24) & 0xffu] ;
}



Deadlock...(RDBMS)- a Joke

Deadlock...(RDBMS)
Boss said to secretary: For a week we will go abroad,
so make arrangement. Secretary make call to Husband: For a week my boss and
I will be going abroad, you look after yourself. Husband make call to secret lover: My wife is going
abroad for a week, so lets spend the week together. Secret lover make call to small boy whom she is giving
private tuition: I have work for a week, so you need
not come for class. Small boy make call to his grandfather: Grandpa, for a
week I don't have class 'coz my teacher is busy. Lets
spend the week together. Grandpa(the 1st boss ;) ) make call to his secretary: This week I am
spending my time with my grandson. We cannot attend
that meeting. Secretary make call to her husband: This week my boss
has some work, we cancelled our trip. Husband make call to secret lover: We cannot spend
this week together, my wife has cancelled her trip. Secret lover make call to small boy whom she is giving
private tuition: This week we will have class as usual…

Quantum computers take step toward practicality

In computing, a logic gate is built to accept a set of inputs and, depending on their properties, provide a specific output. In the binary logic found in today's electrical computers, a certain gate will yield a "1" only if all of its inputs are "1"s. Otherwise it will yield a "0." Similarly, a quantum photonic gate would work by detecting the properties of input photons from two light beams, called "control" and "signal," and then producing an output based on those, such as by flipping the polarization of one of the input photons. clipped from www.physorg.com
Computers based on the powerful properties of quantum mechanics have the potential to revolutionize information technology and security, but for decades they have remained more theoretical than practical, and difficult to scale up. That is changing, however, as demonstrated in a report this week in the journal Science.
In the paper, engineers and physicists from Stanford and t…

How to reverse a String without using C functions

clipped from www.allinterview.com How to reverse a String without using C functions ? the above is slightly wrong
this is the corrected one..
char * rev_string (char * str)
{
char temp;
int i , j;
for (i = 0 ; str[i]!= '\0' ; i++);
for(j = 0 ; j < i ; j++ , i--)
{
temp = str[j];
str[j] = str[i];
str[i] = temp;
}
return str;
} #include<stdio.h>
void reverse(char *);
void main()
{
char str[]="Hello";
reverse(str);
printf("Reverse String is %s",str);
}
void reverse(char *p)
{
char *q=p;
while(*++q!='\0');
q--;
while(p<q)
{
*p=*p+*q;
*q=*p-*q;
*p=*p-*q;
p++;
q--;
}
}

Learning ARM linux commands for creating library

ARM Linux commands starts with arm-linux-* for example compiling source code for ctime.c be

$ arm-linux-gcc -c -o ctimer.o ctimer.c

This linux command generates ctimer.o as output.

I was searching for the ARM-Linux command which will give me library.

$ arm-linux-ar cr libctimer.a ctimer.o

This command gives libctimer.a library to use in ARM linux platform.
Simple usage will be, say this timer library want to use in test.c
Compile test.c as

$ arm-linux-gcc -L. -o tester -I. test.c -lctimer

here . indicates library path, where the library is stored.

And your exe tester is ready.

politely and anonymously ask your friends to stop sending spam

Wondered how you can politely and anonymously ask your friends to stop sending spam,
well stopForwarding.Us
enables you to send politely and anonymous message to your friend on behalf of you,
Below is example mail message which sends polite mail.
One of your friends has sent you this message from StopForwarding.Us, a website that allows individuals to anonymously email their friends and politely ask that they stop the habit of sending forwarded emails or FWDs.Please do not forward chain letters, urban myths presented as truth, potentially offensive jokes, videos or photos without being asked or first receiving permission. If you find something that is funny and it is clean and you genuinely think the recipient will enjoy it then foward it to that person only (not in an email blast to all your friends and family) and include a personal note about why you enjoyed it and why you think they will too. Avoid sending forwards to friends or relatives that you've grown distant with. It can b…

debug macro in kernel - dbg() macro

Help ksymoops out


mkdir /var/log/ksymoops

Every time a module is loaded /proc/ksymsand /proc/modules is copied there.

-k /var/log/ksymoops/.ksyms

-l /var/log/ksymoops/.modules




dbg() macro


#if !defined(CONFIG_FOO_MODULE)
#define MY_NAME "foo_driver"
#else
#define MY_NAME THIS_MODULE->name
#endif

#define dbg(fmt, arg...) do {
if (debug)
printk(KERN_DEBUG "%s: "__FUNCTION__": "
fmt "\n" , MY_NAME , ## arg);
} while (0)

static int debug;
MODULE_PARM(debug, "i");


Using dbg()


dbg ("Added slot %d to the list",
slot->physical_number);

shows up as:
hotplug_pci: pci_hp_register: Added slot 2 to the list


dbg ("");

shows up as:
hotplug_pci: pci_hp_register:


Other printk() macros


#define err(fmt, arg...)
printk(KERN_ERR "%s: " fmt "\n" , MY_NAME , ## arg)

#define info(fmt, arg...)
printk(KERN_INFO "%s: " fmt "\n" , MY_NAME , ## arg)

#define w…