Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | LPC2000 | How do you determine the memory address of an instruction?

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

How do you determine the memory address of an instruction? - codinglikeits1999 - Sep 26 22:08:02 2009


I'm using CodeSourcery G++ Lite 2009Q1. For setting breakpoints in the
GDB command line interface I need to know how to determining the Address
for a given instruction. My understanding is that you use the .map and
.lst files to determine this. First by finding the function's address in
the .map file and then the instructions offset address in the .lst file.
Then add them together. Is this the proper process?

Well enough but when I do this it does not work. As a check, if I
compare the address that I calculate with the address that Insight
calculates, they are not the same. They are off by a magnitude of 50-100
addresses. There must be something else that I'm missing. Can anyone
help with this? Thanks.

[Non-text portions of this message have been removed]

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: How do you determine the memory address of an instruction? - Felipe de A N L - Sep 27 13:43:19 2009

Isn't a Disasamble option on your compiler? There you will get the address
propely.

2009/9/26 codinglikeits1999

>
> I'm using CodeSourcery G++ Lite 2009Q1. For setting breakpoints in the
> GDB command line interface I need to know how to determining the Address
> for a given instruction. My understanding is that you use the .map and
> .lst files to determine this. First by finding the function's address in
> the .map file and then the instructions offset address in the .lst file.
> Then add them together. Is this the proper process?
>
> Well enough but when I do this it does not work. As a check, if I
> compare the address that I calculate with the address that Insight
> calculates, they are not the same. They are off by a magnitude of 50-100
> addresses. There must be something else that I'm missing. Can anyone
> help with this? Thanks.
>
> [Non-text portions of this message have been removed]
>
>
>
[Non-text portions of this message have been removed]

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

RE: How do you determine the memory address of an instruction? - FreeRTOS Info - Sep 27 13:51:15 2009

> > I'm using CodeSourcery G++ Lite 2009Q1.=20

Which is 'just' GCC, so has all the GCC command line options.

> For setting breakpoints in
> the
> > GDB command line interface I need to know how to determining the
> Address
> > for a given instruction.=20
It would be more normal to want to set a break point on a line number or
symbol. Why do you want to set a break point on an instruction? Is your
app written in assembly?
> My understanding is that you use the .map
> and
> > .lst files to determine this. First by finding the function's address
> in
> > the .map file and then the instructions offset address in the .lst
> file.
> > Then add them together. Is this the proper process?

You can find the functions address using GDB, but I'm not sure why you woul=
d
want to as you can just refer to the function using its name. For example,
to put a break point on main() you can just enter 'b main' without knowing
where main was.

Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T=DCV as meeting the requirements for safety related systems.

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

=?iso-8859-1?q?Re:_How_do_you_determine_the_memory_address_of_an_=09instruction=3F?= - codinglikeits1999 - Sep 27 16:02:16 2009


> It would be more normal to want to set a break point on a line
> number or symbol. Why do you want to set a break point on an
> instruction? Is your app written in assembly?

Thanks for the reply. My app is written in C.

>From looking at the GDB documentation It seems that you need to know the address (not the line number) of the instruction that you want to break at. Here is an example command to set a breakpoint at memory addresss 0xFA3: monitor setbp 0xFA3

Using the GDB command line, is there a way to set a breakpoint by line number? I did not see that in any of the documentation.

I fgiured out what I was doing wrong when calculating the memory address from the .map and .lst files. The memory address for a given instruction is calculated as follows:

[Memory Address that the Function starts in the .map file] + ( [Memory Address of the Instruction you want to set beakpoint at in the .lst file] - [Memory Address that the Function starts in the .lst file] )

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How do you determine the memory address of an instruction? - tike...@gmail.com - Sep 28 1:29:36 2009

codinglikeits1999 wrote:
> Using the GDB command line, is there a way to set a breakpoint by line
> number? I did not see that in any of the documentation.

(gdb) help break
Set breakpoint at specified line or function.
break [LOCATION] [thread THREADNUM] [if CONDITION]
LOCATION may be a line number, function name, or "*" and an address.
If a line number is specified, break at start of code for that line.
If a...

--

Timo

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How do you determine the memory address of an instruction? - codinglikeits1999 - Sep 28 20:00:52 2009

OK, I see now that you can break at line numbers. Which file do you get the line numbers from? Each .lst file has their own line numbers starting at 1, so it can't be that. Thanks.
--- In l...@yahoogroups.com, tike64@... wrote:
>
> codinglikeits1999 wrote:
> > Using the GDB command line, is there a way to set a breakpoint by line
> > number? I did not see that in any of the documentation.
>
> (gdb) help break
> Set breakpoint at specified line or function.
> break [LOCATION] [thread THREADNUM] [if CONDITION]
> LOCATION may be a line number, function name, or "*" and an address.
> If a line number is specified, break at start of code for that line.
> If a...
>
> --
>
> Timo
>

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: How do you determine the memory address of an instruction? - rtstofer - Sep 28 22:10:58 2009

--- In l...@yahoogroups.com, "codinglikeits1999" wrote:
>
> OK, I see now that you can break at line numbers. Which file do you get the line numbers from? Each .lst file has their own line numbers starting at 1, so it can't be that. Thanks.
Maybe the .lss file produced by the linker?

Richard

------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

RE: Re: How do you determine the memory address of an instruction? - FreeRTOS Info - Sep 29 0:25:40 2009

> -----Original Message-----
> From: l...@yahoogroups.com [mailto:l...@yahoogroups.com] On
> Behalf Of codinglikeits1999
> Sent: 29 September 2009 01:00
> To: l...@yahoogroups.com
> Subject: [lpc2000] Re: How do you determine the memory address of an
> instruction?
>=20
>=20
>=20
> OK, I see now that you can break at line numbers. Which file do you get
> the line numbers from? Each .lst file has their own line numbers
> starting at 1, so it can't be that. Thanks.
With respect, this is getting a bit tedious. How about you read the manual=
?
If you had done that it would have taken half an hour tops, and you would b=
e
well on your way to developing your system by now?

Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T=DCV as meeting the requirements for safety related systems.

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )