Page 1 of 1

why gdb doesnot show correct value

Posted: Sat Aug 16, 2014 5:53 am
by hitlar
all file below compile & execute successfully in bochs-2.6.2 on fedora-19 but when i debug with gdb in eclipse variables value give wrong value, how can remove

<snip>

Makefile

Code: Select all

SOURCES=boot.o kernel.o 

CFLAGS= -g -nostdlib -nostdinc -fno-builtin
LDFLAGS=-Tkernel.ld
LDFLAGS2=-Tlink.ld
ASFLAGS= -g -felf

all: $(SOURCES) link
	 sh mount.sh

clean:
	-rm *.o kernel

link:
	ld $(LDFLAGS) -o kernel $(SOURCES)
	ld $(LDFLAGS2) -o link $(SOURCES)
	
.s.o:
	nasm $(ASFLAGS) $<
	

Re: why gdb doesnot show correct value

Posted: Sat Aug 16, 2014 7:54 am
by Combuster
Ok, I just stripped 90% of your post. Why did I do that? Because posting masses of code is a clear indication that you couldn't be bothered to find out the actual cause of your problem, and because it's a copy of Higher Half With GDT - Something you could have mentioned instead. Similarly, you've been slacking off even at that for not posting mount.sh and kernel.ld. So far, you didn't seem to have read the forum rules.

The next thing that I found interesting is that your makefile calls ld explicitly, and your host's gcc implicitly. That's a known error as per the Posting Checklist, and I wouldn't be surprised that eclipse's gdb (your host's debugger) refuses to work for the exact same reason as why you shouldn't be using your host compiler for something other than linux. The reason why you're making two different binaries is beyond me as well. So, you missed the FAQ and failed basic sanity checks.


So the real problem is that gdb does not do what you expect. What evidence do you have for that? Is it eclipse's fault or is it gdb's fault?

Re: why gdb doesnot show correct value

Posted: Sat Aug 16, 2014 9:47 pm
by hitlar
sorry, actual make file is same as "Higher Half Kernel with GDT", other line is added just for testing, so it can be removed. i feel gdb does not show correct value due to linker script, what's change in linker script to show correct value

Re: why gdb doesnot show correct value

Posted: Sun Aug 17, 2014 2:40 am
by Combuster
hitlar wrote:sorry, actual make file is same as "Higher Half Kernel with GDT"
Considering that makefile doesn't exist, please stick to the facts.