hi: 2010/7/14 Ian Lance Taylor <iant@xxxxxxxxxx>: > loody <miloody@xxxxxxxxx> writes: > >> I write a sample program and compile it with -O1 optimized. >> (such as gcc -g -O1 -o test test.c) >> And I can see the local variable. >> I attach my test program, kernel config and compile flags for your reference. >> appreciate your help, > > Thanks, but it seems like you are showing us a case which works. Are > you asking why this works and the kernel doesn't work? Can you show us > a case which doesn't work? I paste the content of my gdb as below: ( I stop at line 1242 and I try to print i but gdb refused) Program received signal 0, Signal 0. dummy_timer (_dum=<value optimized out>) at drivers/usb/gadget/dummy_hcd.c:1242 (gdb) p i $13 = <value optimized out> (gdb) list 1237 } 1238 1239 for (i = 0; i < DUMMY_ENDPOINTS; i++) { 1240 if (!ep_name [i]) 1241 break; 1242 dum->ep [i].already_seen = 0; 1243 } 1244 1245 restart: 1246 list_for_each_entry_safe (urbp, tmp, &dum->urbp_list, urbp_list) { (gdb) p i $14 = <value optimized out> (gdb) appreciate your help, miloody