----- Ursprüngliche Nachricht ----- Von: Andrew McLaren Gesendet am: 09 Dez 2011 05:06:23
> I've just upgraded to the uniarch mspgcc (20110716-p20111105 running on > Windows), and am having some strange issues in GDB, which appear to be > GDB having wrong addresses for variables located on the stack. I threw > together a very simple bit of code, which simply updated a variable with > a value, and had a peek at both the debugger, and the assember code. > # uint16_t test1; > # ... > # test1 =1; > When this line is executed, GDB shows test1 as unchanged, but an > adjacent variable is updated to 1. > # 00001188: mov #1, -6(r4) ;r3 As==01, 0xfffa(r4) > r4 has a value of 0xA02 at this point, which would give the target > location of of test1 as 0x9FC. However, the debugger gives me location > 0x9FA for test1. If I change the test1 declaration to static, everything > maps fine. It may be that GDB is not using R4 as frame pointer here but rather R1/SP And something has been pushed on the stack, so SP has changed and so all variables seem to have moved by 2 bytes down for GDB. When turning optimization on, mspgcc often does remove R4 completely if the stack pointer isn't altered. On mspgcc 3.2.3, this causes the (erroneous) elimination of R4 when you push something on stack manually (e.g the SR before setting GIE) Or when a function has stack parameters as well as local variables. In the first case, until you 'restore' the stack, all access to local variables is wrong. In the second case, everything is messed-up completely throughout the whole function. > Are there any known issues around the debug symbols being produced by > mspgcc? I'm using the -ggdb compile option to msp430-gcc, but have tried > other debug options with no change. I don't think it's the debug symbols itself. It's more likely the interpretation of what is the frame pointer, as local variables are relative to the frame pointer. There must be specific information for local variables, since in some cases, a local variable may be temporarily buffered in a regsiter, and still the debugger should display its content correctly, even if it is not (yet) written back to memory. But as a no-debugger-user, I don't have much experience with using any debugger. At least on the MSP. JMGross ------------------------------------------------------------------------------ Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users