935 |
935 |
936 fail: |
936 fail: |
937 return err; |
937 return err; |
938 } |
938 } |
939 |
939 |
940 static int |
940 static int scopeDesc_chain(Nmethod_t *N) { |
941 scopeDesc_chain(Nmethod_t *N) |
|
942 { |
|
943 int32_t decode_offset = 0; |
941 int32_t decode_offset = 0; |
944 int32_t err; |
942 int32_t err; |
945 |
943 |
946 if (debug > 2) |
944 if (debug > 2) { |
947 fprintf(stderr, "\t scopeDesc_chain: BEGIN\n"); |
945 fprintf(stderr, "\t scopeDesc_chain: BEGIN\n"); |
|
946 } |
948 |
947 |
949 err = ps_pread(N->J->P, N->pc_desc + OFFSET_PcDesc_scope_decode_offset, |
948 err = ps_pread(N->J->P, N->pc_desc + OFFSET_PcDesc_scope_decode_offset, |
950 &decode_offset, SZ32); |
949 &decode_offset, SZ32); |
951 CHECK_FAIL(err); |
950 CHECK_FAIL(err); |
952 |
951 |
953 while (decode_offset > 0) { |
952 while (decode_offset > 0) { |
954 if (debug > 2) |
953 Vframe_t *vf = &N->vframes[N->vf_cnt]; |
955 fprintf(stderr, "\t scopeDesc_chain: decode_offset: %#x\n", decode_offset); |
954 |
956 |
955 if (debug > 2) { |
957 Vframe_t *vf = &N->vframes[N->vf_cnt]; |
956 fprintf(stderr, "\t scopeDesc_chain: decode_offset: %#x\n", decode_offset); |
958 |
957 } |
959 err = scope_desc_at(N, decode_offset, vf); |
958 |
|
959 err = scope_desc_at(N, decode_offset, vf); |
|
960 CHECK_FAIL(err); |
|
961 |
|
962 if (vf->methodIdx > N->oops_len) { |
|
963 fprintf(stderr, "\t scopeDesc_chain: (methodIdx > oops_len) !\n"); |
|
964 return -1; |
|
965 } |
|
966 err = read_pointer(N->J, N->nm + N->oops_beg + (vf->methodIdx-1)*POINTER_SIZE, |
|
967 &vf->methodOop); |
|
968 CHECK_FAIL(err); |
|
969 |
|
970 if (vf->methodOop) { |
|
971 N->vf_cnt++; |
|
972 err = line_number_from_bci(N->J, vf); |
960 CHECK_FAIL(err); |
973 CHECK_FAIL(err); |
961 |
974 if (debug > 2) { |
962 if (vf->methodIdx > N->oops_len) { |
975 fprintf(stderr, "\t scopeDesc_chain: methodOop: %#8llx, line: %ld\n", |
963 fprintf(stderr, "\t scopeDesc_chain: (methodIdx > oops_len) !\n"); |
976 vf->methodOop, vf->line); |
964 return -1; |
|
965 } |
977 } |
966 err = read_pointer(N->J, N->nm + N->oops_beg + (vf->methodIdx-1)*POINTER_SIZE, |
978 } |
967 &vf->methodOop); |
979 decode_offset = vf->sender_decode_offset; |
968 CHECK_FAIL(err); |
980 } |
969 |
981 if (debug > 2) { |
970 if (vf->methodOop) { |
982 fprintf(stderr, "\t scopeDesc_chain: END \n\n"); |
971 N->vf_cnt++; |
983 } |
972 err = line_number_from_bci(N->J, vf); |
984 return PS_OK; |
973 CHECK_FAIL(err); |
985 |
974 if (debug > 2) { |
986 fail: |
975 fprintf(stderr, "\t scopeDesc_chain: methodOop: %#8llx, line: %ld\n", |
987 if (debug) { |
976 vf->methodOop, vf->line); |
988 fprintf(stderr, "\t scopeDesc_chain: FAIL \n\n"); |
977 } |
989 } |
978 } |
|
979 decode_offset = vf->sender_decode_offset; |
|
980 } |
|
981 if (debug > 2) |
|
982 fprintf(stderr, "\t scopeDesc_chain: END \n\n"); |
|
983 return PS_OK; |
|
984 |
|
985 fail: |
|
986 if (debug) |
|
987 fprintf(stderr, "\t scopeDesc_chain: FAIL \n\n"); |
|
988 return err; |
990 return err; |
989 } |
991 } |
990 |
992 |
991 |
993 |
992 static int |
994 static int |