MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / DecodeDebugPositionInfo

Method DecodeDebugPositionInfo

Bcore/src/main/cpp/dex/dex_file-inl.h:420–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418
419template<typename DexDebugNewPosition, typename IndexToStringData>
420bool DexFile::DecodeDebugPositionInfo(const uint8_t* stream,
421 IndexToStringData index_to_string_data,
422 DexDebugNewPosition position_functor,
423 void* context) {
424 if (stream == nullptr) {
425 return false;
426 }
427
428 PositionInfo entry = PositionInfo();
429 entry.line_ = DecodeUnsignedLeb128(&stream);
430 uint32_t parameters_size = DecodeUnsignedLeb128(&stream);
431 for (uint32_t i = 0; i < parameters_size; ++i) {
432 DecodeUnsignedLeb128P1(&stream); // Parameter name.
433 }
434
435 for (;;) {
436 uint8_t opcode = *stream++;
437 switch (opcode) {
438 case DBG_END_SEQUENCE:
439 return true; // end of stream.
440 case DBG_ADVANCE_PC:
441 entry.address_ += DecodeUnsignedLeb128(&stream);
442 break;
443 case DBG_ADVANCE_LINE:
444 entry.line_ += DecodeSignedLeb128(&stream);
445 break;
446 case DBG_START_LOCAL:
447 DecodeUnsignedLeb128(&stream); // reg.
448 DecodeUnsignedLeb128P1(&stream); // name.
449 DecodeUnsignedLeb128P1(&stream); // descriptor.
450 break;
451 case DBG_START_LOCAL_EXTENDED:
452 DecodeUnsignedLeb128(&stream); // reg.
453 DecodeUnsignedLeb128P1(&stream); // name.
454 DecodeUnsignedLeb128P1(&stream); // descriptor.
455 DecodeUnsignedLeb128P1(&stream); // signature.
456 break;
457 case DBG_END_LOCAL:
458 case DBG_RESTART_LOCAL:
459 DecodeUnsignedLeb128(&stream); // reg.
460 break;
461 case DBG_SET_PROLOGUE_END:
462 entry.prologue_end_ = true;
463 break;
464 case DBG_SET_EPILOGUE_BEGIN:
465 entry.epilogue_begin_ = true;
466 break;
467 case DBG_SET_FILE: {
468 uint32_t name_idx = DecodeUnsignedLeb128P1(&stream);
469 entry.source_file_ = index_to_string_data(name_idx);
470 break;
471 }
472 default: {
473 int adjopcode = opcode - DBG_FIRST_SPECIAL;
474 entry.address_ += adjopcode / DBG_LINE_RANGE;
475 entry.line_ += DBG_LINE_BASE + (adjopcode % DBG_LINE_RANGE);
476 if (position_functor(context, entry)) {
477 return true; // early exit.

Callers

nothing calls this directly

Calls 5

PositionInfoClass · 0.85
DecodeUnsignedLeb128Function · 0.85
DecodeUnsignedLeb128P1Function · 0.85
DecodeSignedLeb128Function · 0.85
StringIndexClass · 0.85

Tested by

no test coverage detected