i am trying to debug xv6, using qemu emulator, with gdb kernel.
How ever, gdb wont recognize any additions i do to the files. for example, it wont recognize new files, or even new lines in a existing file, for example:
in file x86.h i have added anouther function, this is the code (i have added cas):
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
}
static inline uint
cas(volatile int *addr,int expected, int newval)
{
uint flags;
uint zf;
asm volatile("movl %0,%%eax;lock;cmpxchg %2,%3;jne afterChange;movl %%eax,%0;afterChange:;pushfl; popl %1":"+m"(*addr),"=r"(flags):"r"(expected),"r"(newval):"%eax");
zf = (flags >> 6) & 1;
return zf;
}
gdb will recognize lcr3, but wont recognize cas, however, when i actually search the file, i can find the lines:
(gdb) list lcr3
138 return val;
139 }
140
141 static inline void
142 lcr3(uint val)
143 {
144 asm volatile("movl %0,%%cr3" : : "r" (val));
145 }
146
147 static inline uint
(gdb) list
148 cas(volatile int *addr,int expected, int newval)
149 {
150 uint flags;
151 uint zf;
152 asm volatile("movl %0,%%eax;lock;cmpxchg %2,%3;jne afterChange;movl %%eax,%0;afterChange:;pushfl; popl %1":"+m"(*addr),"=r"(flags):"r"(expected),"r"(newval):"%eax");
153 //zf = (flags >> 6) & 1;
154 zf = flags;
155 return zf;
156 }
157
i am using this makefile (the basic xv6 makefile): https://github.com/mit-pdos/xv6-public/blob/master/Makefile
Would be glad for any assistance. thank you.
gdb wont recognize any additions i do to the files.
i have created a new copy, updated the modified files, and compiled (fresh). did not work
This very likely means that you are debugging an old copy of the file you think you are debugging.
Do this:
ls -il xv6
to observe its (recent) timestamp. It should be recent because you've done make clean
and rebuilt it.rm -f xv6; ls -l xv6
to verify that the file is gone.Update:
I am updating the right files, as i mentioned in the initial post, when i actually look into the files content using gdb i can see the modifications.
You are (apparently) talking about source files. GDB doesn't care about source files, and doesn't use them (except when you ask GDB to list
them). GDB only cares about the compiled binary, and that is the file you are somehow neglecting to update.