ErichStyger / mcuoneclipse

McuOnEclipse Processor Expert components and example projects
Other
731 stars 1.29k forks source link

Bad cast in gprof for arm #34

Closed ptrebuc closed 7 years ago

ptrebuc commented 7 years ago

I try to reuse in a somewhat different context your great work on gprof, and I found a bug in the git hub implementation.

gmon.c:267 frompcindex should not be used but a fresh uint16t * should

p->froms is a u_short *

best regards

ErichStyger commented 7 years ago

I'm not really sure what you mean? Are you referring to: https://github.com/ErichStyger/mcuoneclipse/blob/59e5aeffe5d42874f33a9ea5a86669ac7e0958ce/Examples/KDS/FRDM-K64F120M/FRDM-K64F_Profiling/Profiling/gmon.c ?

ptrebuc commented 7 years ago

yes line 269 *frompcindex = toindex; at this moment frompcindex contains the address of an element of p->froms.

p->froms is a ushort * this means that if two function calls are too near the data are corrupted

Am I wrong ?

Best

On Mon, Jan 9, 2017 at 1:27 PM, Erich Styger notifications@github.com wrote:

I'm not really sure what you mean? Are you referring to: https://github.com/ErichStyger/mcuoneclipse/blob/ 59e5aeffe5d42874f33a9ea5a86669ac7e0958ce/Examples/KDS/FRDM- K64F120M/FRDM-K64F_Profiling/Profiling/gmon.c ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ErichStyger/mcuoneclipse/issues/34#issuecomment-271272713, or mute the thread https://github.com/notifications/unsubscribe-auth/AXzjRlErISLT4S0MHfY2Qqsbn4XEls4Hks5rQifOgaJpZM4Lc2Rc .

-- Philippe Le jeu est la forme la plus élevée de la recherche. -+- Albert Einstein -+-

ErichStyger commented 7 years ago

No, you are absolutely correct, this is indeed a bad bug :-( I have made a fix in https://github.com/ErichStyger/mcuoneclipse/commit/9b7eedddd8b24968128582aedc63be95b61f782c Thanks for finding it!