Skip to content

Commit

Permalink
fix for issue #34 where it was reading/writing 32bit values instead o…
Browse files Browse the repository at this point in the history
…f 16bit ones.
  • Loading branch information
Erich Styger committed Jan 9, 2017
1 parent 87d86ef commit 9b7eedd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Examples/KDS/FRDM-K64F120M/FRDM-K64F_Profiling/Profiling/gmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void _mcount_internal(uint32_t *frompcindex, uint32_t *selfpc) {
goto done;
}
frompcindex = (uint32_t*)&p->froms[((long)frompcindex) / (HASHFRACTION * sizeof(*p->froms))];
toindex = *frompcindex;
toindex = *((u_short*)frompcindex); /* get froms[] value */
if (toindex == 0) {
/*
* first time traversing this arc
Expand All @@ -266,7 +266,7 @@ void _mcount_internal(uint32_t *frompcindex, uint32_t *selfpc) {
if (toindex >= p->tolimit) { /* more tos[] entries than we can handle! */
goto overflow;
}
*frompcindex = toindex;
*((u_short*)frompcindex) = (u_short)toindex; /* store new 'to' value into froms[] */
top = &p->tos[toindex];
top->selfpc = (size_t)selfpc;
top->count = 1;
Expand Down Expand Up @@ -302,8 +302,8 @@ void _mcount_internal(uint32_t *frompcindex, uint32_t *selfpc) {
top = &p->tos[toindex];
top->selfpc = (size_t)selfpc;
top->count = 1;
top->link = *frompcindex;
*frompcindex = toindex;
top->link = *((u_short*)frompcindex);
*(u_short*)frompcindex = (u_short)toindex;
goto done;
}
/*
Expand All @@ -320,8 +320,8 @@ void _mcount_internal(uint32_t *frompcindex, uint32_t *selfpc) {
top->count++;
toindex = prevtop->link;
prevtop->link = top->link;
top->link = *frompcindex;
*frompcindex = toindex;
top->link = *((u_short*)frompcindex);
*((u_short*)frompcindex) = (u_short)toindex;
goto done;
}
}
Expand Down

0 comments on commit 9b7eedd

Please sign in to comment.