|
|
Mozy Online Backup: 2GB Free. Automatic. Secure.
Subject: debug with kgdb,why not work? - msg#00007
List: linux.kernel.debugging.kgdb.bugs
Hi, all.
For days, I am searching for a way to look inside the linux kernel
for studying it. I have tried kdb,kgdb and user-mode-linux, and think
kgdb is better. All I have setup for kgdb,the target machine waiting
for remote connection, the develep machine connecs to it, and control
the target. All things look good. But when I setup breakpoints in
linux-2.4.23/mm/vmscan.c:820, that is ,the place
kswapd()->kswapd_balance(),and let target continue running, I can't
see target stop at this breakpoint. As I know, kswap is a background
and will invoke from time to time. I use "thread 5" to switch to
kswapd and still doesn't work. Is it any matter with multi-processes
or muti-threads? I know little about gdb debugging muti-programming.
But as I tried UML(user mode linux), the kswap can easily hit the
breakpoint. but uml modifies kernel code too much, I don't like it
very much ...
I have read many from the linsyssoft.com but can' find an answer.
Any hints from you are very very appreciated.
Thanks.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
Was this page helpful?
Thread at a glance:
Next Message by Date:
click to view message preview
Re: debug with kgdb,why not work?
èèè,
vmscan.c:820 contains a call to kswapd_balance, which is defined as a static
function earlier (line 725). Gcc will expand this call inline. The call to
remove_wait_queue is also expanded inline since remove_wait_queue is defined
as a static inline function.
811
812 __set_current_state(TASK_RUNNING);
813 remove_wait_queue(&kswapd_wait, &wait);
814
815 /*
816 * If we actually get into a low-memory situation,
817 * the processes needing more memory will wake us
818 * up on a more timely basis.
819 */
820 kswapd_balance();
821 run_task_queue(&tq_disk);
822 }
823 }
824
At present gcc or gdb respectively can't generate and handle inline functions
as good as they do real functions. You'll see line nos correctly but not all
the symbol information. You may try placing a breakpoint inside
kswapd_balance, line no. 731, which is a simple C statement.
725 static void kswapd_balance(void)
726 {
727 int need_more_balance;
728 pg_data_t * pgdat;
729
730 do {
731 need_more_balance = 0;
732
info threads should work fine. "thread 5" will not switch threads in the
kernel. It'll only ask gdb to use thread 5 for further commands like
backtrace. A backtrace command after a "thread 5" command (assuming that the
kswapd is thread number 5) will show you the backtrace kswapd at the state
where it's sleeping or is running on another processor.
--
Amit Kale
LinSysSoft Technologies
Ask me about KGDB Pro
http://www.linsyssoft.com/Kgdbpro.html
On Monday 05 Dec 2005 10:54 am, èèè wrote:
> Hi, all.
>
> For days, I am searching for a way to look inside the linux kernel
> for studying it. I have tried kdb,kgdb and user-mode-linux, and think
> kgdb is better. All I have setup for kgdb,the target machine waiting
> for remote connection, the develep machine connecs to it, and control
> the target. All things look good. But when I setup breakpoints in
> linux-2.4.23/mm/vmscan.c:820, that is ,the place
> kswapd()->kswapd_balance(),and let target continue running, I can't
> see target stop at this breakpoint. As I know, kswap is a background
> and will invoke from time to time. I use "thread 5" to switch to
> kswapd and still doesn't work. Is it any matter with multi-processes
> or muti-threads? I know little about gdb debugging muti-programming.
> But as I tried UML(user mode linux), the kswap can easily hit the
> breakpoint. but uml modifies kernel code too much, I don't like it
> very much ...
> I have read many from the linsyssoft.com but can' find an answer.
> Any hints from you are very very appreciated.
> Thanks.
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=Click
> _______________________________________________
> Kgdb-bugreport mailing list
> Kgdb-bugreport@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
Next Message by Thread:
click to view message preview
Re: debug with kgdb,why not work?
èèè,
vmscan.c:820 contains a call to kswapd_balance, which is defined as a static
function earlier (line 725). Gcc will expand this call inline. The call to
remove_wait_queue is also expanded inline since remove_wait_queue is defined
as a static inline function.
811
812 __set_current_state(TASK_RUNNING);
813 remove_wait_queue(&kswapd_wait, &wait);
814
815 /*
816 * If we actually get into a low-memory situation,
817 * the processes needing more memory will wake us
818 * up on a more timely basis.
819 */
820 kswapd_balance();
821 run_task_queue(&tq_disk);
822 }
823 }
824
At present gcc or gdb respectively can't generate and handle inline functions
as good as they do real functions. You'll see line nos correctly but not all
the symbol information. You may try placing a breakpoint inside
kswapd_balance, line no. 731, which is a simple C statement.
725 static void kswapd_balance(void)
726 {
727 int need_more_balance;
728 pg_data_t * pgdat;
729
730 do {
731 need_more_balance = 0;
732
info threads should work fine. "thread 5" will not switch threads in the
kernel. It'll only ask gdb to use thread 5 for further commands like
backtrace. A backtrace command after a "thread 5" command (assuming that the
kswapd is thread number 5) will show you the backtrace kswapd at the state
where it's sleeping or is running on another processor.
--
Amit Kale
LinSysSoft Technologies
Ask me about KGDB Pro
http://www.linsyssoft.com/Kgdbpro.html
On Monday 05 Dec 2005 10:54 am, èèè wrote:
> Hi, all.
>
> For days, I am searching for a way to look inside the linux kernel
> for studying it. I have tried kdb,kgdb and user-mode-linux, and think
> kgdb is better. All I have setup for kgdb,the target machine waiting
> for remote connection, the develep machine connecs to it, and control
> the target. All things look good. But when I setup breakpoints in
> linux-2.4.23/mm/vmscan.c:820, that is ,the place
> kswapd()->kswapd_balance(),and let target continue running, I can't
> see target stop at this breakpoint. As I know, kswap is a background
> and will invoke from time to time. I use "thread 5" to switch to
> kswapd and still doesn't work. Is it any matter with multi-processes
> or muti-threads? I know little about gdb debugging muti-programming.
> But as I tried UML(user mode linux), the kswap can easily hit the
> breakpoint. but uml modifies kernel code too much, I don't like it
> very much ...
> I have read many from the linsyssoft.com but can' find an answer.
> Any hints from you are very very appreciated.
> Thanks.
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=Click
> _______________________________________________
> Kgdb-bugreport mailing list
> Kgdb-bugreport@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
|
|