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

See the CrossGCC FAQ for lots more infromation.


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

Re: Debugging on h8/300


Oops, not expecting any really big errors makes one blind...

RakeshN wrote:
> I am using gdb to debug a small program......
> 
> I compile it with gcc -g -c -S test.c

 The '-c' should produce an object file 'test.o' from your
program...

 The '-S' should produce an assembly output 'test.s' from your
program...

 Using them both at the same time, hmmm... produces only the
'test.s' because the '-S' was later in the command line...

 How on earth you got the 'test.o' with your command?

> 
> I run gdb as
> 
> gdb
> file test.o
> target sim
> load test.o
> break 6
> run
> ..

 Loading only the unlinked object and trying to debug it, is
also totally new for me... Hmmm, after producing the object
with 'gcc -c test.s', this can however be tried... 

--------------------- clip ---------------------------
(gdb) file rakeshn.o
(gdb) target sim
Connected to the simulator.

(gdb) load rakeshn.o
Loading section .text, size 0x26 vma 0x0
Start address 0x0
Transfer rate: 304 bits in <1 sec.

(gdb) run
Starting program: E:\usr\local\samples\h8300/rakeshn.o 

Program received signal SIGILL, Illegal instruction.
0xfffc in ?? ()
--------------------- clip ---------------------------

 Ok, doing these kind of 'silly' things isn't much fun,
but perhaps you also linked your program...
   
> When i print the value of 'a' using print /x a
> the value is
> 
> $1 = 0x0
> 
> Why so? since i have assigned a to 1.

 Trying a linked version with my 'gdb-4.18.2', I will
get on separate lines:

Breakpoint 2, main () at rakeshn.c:6

(gdb) print /x a
$1 = 0x0

(gdb) print /x a
$2 = 0x1

(gdb) print /x a
$3 = 0x4

 My GDB was the Insight, so these were taken from the
GDB-console, the single-steps happened in the Source
Window...
  
> Where am i going wrong?

 Heaven knows... Please report much better what you REALLY
did, what is the GDB you have, who made it (who could give
you a fixed one) etc.

 AFAIK, the gdb-4.18 had a bug in showing the variable values.
The 'gdb-4.18.2' in my GDB just says that this and many other
bugs were fixed... I had the Win32-hosted one downloadable till
the end of July 2000, sad if you use Windoze and didn't download
it then...

Cheers, Kai



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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