Class: Android::Dex::DexObject::CodeItem

Inherits:
Android::Dex::DexObject show all
Defined in:
lib/android/dex/dex_object.rb

Overview

code_item

Instance Attribute Summary collapse

Attributes inherited from Android::Dex::DexObject

#size

Method Summary

Methods inherited from Android::Dex::DexObject

#[], #initialize, #inspect, #symbols

Constructor Details

This class inherits a constructor from Android::Dex::DexObject

Instance Attribute Details

#debug_info_itemDebugInfoItem (readonly)

Returns debug_info_item of this code.

Returns:



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/android/dex/dex_object.rb', line 391

class CodeItem < DexObject
  def debug_info_item
    unless @params[:debug_info_off] == 0
      @debug_info_item ||= DebugInfoItem.new(@data, @params[:debug_info_off])
    else
      nil
    end
  end

  private
  def parse
    @params[:registers_size] = read_value(:ushort)
    @params[:ins_size] = read_value(:ushort)
    @params[:outs_size] = read_value(:ushort)
    @params[:tries_size] = read_value(:ushort)
    @params[:debug_info_off] = read_value(:uint)
    @params[:insns_size] = read_value(:uint) # size of the instructions list
    @params[:insns] = read_value_array(:ushort, @params[:insns_size])
    read_value(:ushort) if ((@params[:insns_size] % 2) == 1) # for four-byte aligned
    if @params[:tries_size] > 0
      # This element is only present if tries_size is non-zero.
      @params[:tries] = read_class_array(TryItem, @params[:tries_size])
      # This element is only present if tries_size is non-zero.
      @params[:handlers] = EncodedCatchHandlerList.new(@data, @offset + @parsing_off)
      @parsing_off += @params[:handlers].size
    end
  end
end