History

tccrun.c: unify rt_get_caller_pc prototype

grischka committed 13 years ago

Commit 4b539aa1 parent 97c279f1 file · +15 −18Browse files

Unified · Split

tccrun.c+15−18
@@ -461,10 +461,10 @@ static void set_exception_handler(void) · 460 unmodified lines
461461 #define REG_EBP EBP
462462 #endif
463463
464−/* return the PC at frame level 'level'. Return non zero if not found */
464+/* return the PC at frame level 'level'. Return negative if not found */
465465 static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
466466 {
467− unsigned long fp;
467+ addr_t fp;
468468 int i;
469469
470470 if (level == 0) {
@@ -492,9 +492,9 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 21 unmodified lines
492492 /* XXX: check address validity with program info */
493493 if (fp <= 0x1000 || fp >= 0xc0000000)
494494 return -1;
495− fp = ((unsigned long *)fp)[0];
495+ fp = ((addr_t *)fp)[0];
496496 }
497− *paddr = ((unsigned long *)fp)[1];
497+ *paddr = ((addr_t *)fp)[1];
498498 return 0;
499499 }
500500 }
@@ -502,11 +502,10 @@ static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level) · 1 unmodified line
502502 /* ------------------------------------------------------------- */
503503 #elif defined(__x86_64__)
504504
505−/* return the PC at frame level 'level'. Return non zero if not found */
506−static int rt_get_caller_pc(unsigned long *paddr,
507− ucontext_t *uc, int level)
505+/* return the PC at frame level 'level'. Return negative if not found */
506+static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
508507 {
509− unsigned long fp;
508+ addr_t fp;
510509 int i;
511510
512511 if (level == 0) {
@@ -531,9 +530,9 @@ static int rt_get_caller_pc(unsigned long *paddr, · 18 unmodified lines
531530 /* XXX: check address validity with program info */
532531 if (fp <= 0x1000)
533532 return -1;
534− fp = ((unsigned long *)fp)[0];
533+ fp = ((addr_t *)fp)[0];
535534 }
536− *paddr = ((unsigned long *)fp)[1];
535+ *paddr = ((addr_t *)fp)[1];
537536 return 0;
538537 }
539538 }
@@ -542,10 +541,9 @@ static int rt_get_caller_pc(unsigned long *paddr, · 2 unmodified lines
542541 #elif defined(__arm__)
543542
544543 /* return the PC at frame level 'level'. Return negative if not found */
545−static int rt_get_caller_pc(unsigned long *paddr,
546− ucontext_t *uc, int level)
544+static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
547545 {
548− uint32_t fp, sp;
546+ addr_t fp, sp;
549547 int i;
550548
551549 if (level == 0) {
@@ -569,15 +567,15 @@ static int rt_get_caller_pc(unsigned long *paddr, · 17 unmodified lines
569567 if (fp < sp + 12 || fp & 3)
570568 return -1;
571569 for(i = 1; i < level; i++) {
572− sp = ((uint32_t *)fp)[-2];
570+ sp = ((addr_t *)fp)[-2];
573571 if (sp < fp || sp - fp > 16 || sp & 3)
574572 return -1;
575− fp = ((uint32_t *)fp)[-3];
573+ fp = ((addr_t *)fp)[-3];
576574 if (fp <= sp || fp - sp < 12 || fp & 3)
577575 return -1;
578576 }
579577 /* XXX: check address validity with program info */
580− *paddr = ((uint32_t *)fp)[-1];
578+ *paddr = ((addr_t *)fp)[-1];
581579 return 0;
582580 }
583581 }
@@ -586,8 +584,7 @@ static int rt_get_caller_pc(unsigned long *paddr, · 2 unmodified lines
586584 #else
587585
588586 #warning add arch specific rt_get_caller_pc()
589−static int rt_get_caller_pc(unsigned long *paddr,
590− ucontext_t *uc, int level)
587+static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level)
591588 {
592589 return -1;
593590 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t