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:



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/android/dex/dex_object.rb', line 351

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