+ if (code == NULL) {
+ prevsfi = tmpsfi->prev;
+
+ /* If the previous stackframeinfo in the chain is NULL we
+ reached the top of the stacktrace and return false. */
+
+ if (prevsfi == NULL)
+ return false;
+
+ /* Fill the temporary stackframeinfo with the new values. */
+
+ tmpsfi->code = prevsfi->code;
+ tmpsfi->pv = prevsfi->pv;
+ tmpsfi->sp = prevsfi->sp;
+ tmpsfi->ra = prevsfi->ra;
+ tmpsfi->xpc = prevsfi->xpc;
+
+ /* Set the previous stackframe info of the temporary one to
+ the next in the chain. */
+
+ tmpsfi->prev = prevsfi->prev;
+ }
+ else {
+ /* Store the new values in the stackframeinfo. NOTE: We
+ subtract 1 from the RA to get the XPC, because the RA
+ points to the instruction after the call instruction. */
+
+ tmpsfi->code = code;
+ tmpsfi->pv = pv;
+ tmpsfi->sp = sp;
+ tmpsfi->ra = ra;
+ tmpsfi->xpc = (void *) (((intptr_t) ra) - 1);
+ }
+
+ return true;