gdb Flow

Ramana Radhakrishnan ramana.radhakrishnan@codito.com
Tue Jan 4 04:56:00 GMT 2005


Hey,

> Hello Group,
> 
>    we have developed a new processor and have got a version of
> gcc(3.2)(including gdb) ported to this machine by an external agency.
> Here we have a problem:
> 
> Our processor is a 16-bit processor (i.e. address X is 16-bits away from
> address X+1). An char and integer are 16-bits long each and a pointer is
> 32-bits long. In the course of using our new gdb, we observed that
> whenever we are printing the value of a pointer variable, we are getting
> wrong values. I tried to figure out the reason and found the following:
> 1. Suppose that a variable exists in memory location 0x10000057 (our
> data section starts from 0x10000000 followed by BSS, HEAP(64k) and
> STACK) and a pointer is assigned the address of the variable.

You might like to start with printcmd.c in the gdb sources where the 
print command is handled.

> 2. But if I print the value of the pointer, it shows only 0x57 instead
> of 0x10000057.

Looking at your problem , you might like to look at the macros 
ADDRESS_TO_POINTER and POINTER_TO_ADDRESS and check their definitions ?

> 3. So, instead of fetching the value from 0x10000057, gdb is fetching
> the value from 0x57.

I assume you are doing remote debugging through a stub or is it a jtag 
based port ? If you are debugging through a remote stub using target 
remote , you might as well do set debug remote 1 and look at the remote 
protocol messages being transferred.

In any case you can see what transactions happen with the target 
debuggee by setting set debug target 1.

Hope this helps. Also you can do set debug expr to see what happens with 
an expression when GDB processes it. At the gdb prompt :

$> help set debug

will give you more options to explore.Hope this helps !

cheers
Ramana

---
Ramana Radhakrishnan
GNU Tools
codito ergo sum(www.codito.com)



More information about the Gdb mailing list