why gdb doesnot show correct value

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
hitlar
Posts: 9
Joined: Wed Jul 03, 2013 8:25 pm

why gdb doesnot show correct value

Post 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) $<
	
Last edited by Combuster on Sat Aug 16, 2014 7:39 am, edited 2 times in total.
Reason: Added [code] tags, removed full-page copy of Higher_Half_With_GDT wiki page
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: why gdb doesnot show correct value

Post 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?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
hitlar
Posts: 9
Joined: Wed Jul 03, 2013 8:25 pm

Re: why gdb doesnot show correct value

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: why gdb doesnot show correct value

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply