This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

2.5.1 bug with local variables ??


Hi !

 In the below gdb.log there are no local variables in fun2 (as reported by
 info local) but p /x i2 still reports a value of 0x3f (see end of gdb.log) 
 this happens to be the value from i1 in fun1 - should this not show up as 

(gdb) info local
No locals.
(gdb) p /x i2
$2 = <value optimized out> 

 (relevant compil flags -O2 -gdwarf -g3 -ggdb3) 

thx !
hofrat

---gdb.log--- 
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) modaddsym ../modules/rtl_sched.o
add symbol table from file "../modules/rtl_sched.o" at
	.text_addr = 0xd0e68060
(gdb) modaddsym ../modules/rr tl.o
add symbol table from file "../modules/rtl.o" at
	.text_addr = 0xd0e57060
(gdb) target remote /dev/rtf10
Remote debugging using /dev/rtf10
[New Thread -850526208]
[Switching to Thread -850526208]
0xd0e8409d in cleanup_module () at hello_core.c:24
24		breakpoint();
(gdb) l
19		p . sched_priority = 1;
20		pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);
21	
22		pthread_make_periodic_np (pthread_self(), gethrtime(), 500000000);
23	
24		breakpoint();
25	
26		for (i = 0; i < 20; i ++) {
27			pthread_wait_np ();
28			rtl_printf("I'm here; my arg is %x\n", (unsigned) arg);
(gdb) l
29			fun1((void *)42);
30			fun2();
31		}
32		return 0;
33	}
34	
35	int init_module(void)
36	{
37		pthread_create (&thread, NULL, thread_routine, NULL);
38		return 0;
(gdb) break fun1
Breakpoint 1 at 0xd0e84127: file fun1.c, line 9.
(gdb) break fun2
Breakpoint 2 at 0xd0e84170: file fun2.c, line 11.
(gdb) c
Continuing.

Breakpoint 1, fun1 (arg=0x2a) at fun1.c:9
9		breakpoint();
(gdb) l
4	extern int g;
5	
6	void fun1(void *arg)
7	{
8		int i1;
9		breakpoint();
10		i1=((int)arg*3)/2;
11		rtl_printf("The Value of i is fun1 is %d\n",i1);
12		g=i1;
13		return ;	
(gdb) s
10		i1=((int)arg*3)/2;
(gdb) s
11		rtl_printf("The Value of i is fun1 is %d\n",i1);
(gdb) info local
i1 = 63
(gdb) p /x i1
$1 = 0x3f
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0xd0e8416d in fun2 () at fun2.c:9
9		breakpoint();
(gdb) l
4	extern int g;
5	
6	void fun2(void)
7	{
8		int i2;
9		breakpoint();
10		i2=1;
11		rtl_printf("The Value of i is fun2 is %d\n",i2);
12		g=i2;
13		return ;	
(gdb) info local
No locals.
(gdb) p /x i2
$2 = 0x3f
(gdb) quit
The program is running.  Exit anyway? (y or n) 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]