jdbg

package
v0.0.0-...-15b4445 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package jdbg provides a simpler interface to the jdwp package, offering simple type resolving and method invoking functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(conn *jdwp.Connection, thread jdwp.ThreadID, f func(jdbg *JDbg) error) error

Do calls f with a JDbg instance, returning the error returned by f. If any JDWP errors are raised during the call to f, then execution of f is immediately terminated, and the JDWP error is returned.

func Try

func Try(f func() error) (err error)

Try calls f, catching and returning any exceptions thrown.

Types

type Array

type Array struct {
	*Class
	// contains filtered or unexported fields
}

Array is the type of an array.

func (*Array) CastableTo

func (t *Array) CastableTo(ty Type) bool

CastableTo returns true if this type can be cast to ty.

func (*Array) New

func (t *Array) New(size int) Value

New constructs a new array of the specified size.

func (*Array) String

func (t *Array) String() string

type Class

type Class struct {
	// contains filtered or unexported fields
}

Class is the type of an object.

func (*Class) Call

func (t *Class) Call(method string, args ...interface{}) Value

Call invokes a static method on the class.

func (*Class) CastableTo

func (t *Class) CastableTo(ty Type) bool

CastableTo returns true if this type can be cast to ty.

func (*Class) Field

func (t *Class) Field(name string) Value

Field returns the value of the static field with the given name.

func (*Class) ID

func (t *Class) ID() jdwp.ClassID

ID returns the JDWP class identifier.

func (*Class) New

func (t *Class) New(args ...interface{}) Value

New returns a new instance of the class type using the specified parameters.

func (*Class) Signature

func (t *Class) Signature() string

Signature returns the Java signature for the type.

func (*Class) String

func (t *Class) String() string

func (*Class) Super

func (t *Class) Super() *Class

Super returns the super class type.

type Errors

type Errors []error

Errors is a collection of errors.

func (Errors) Error

func (l Errors) Error() string

type JDbg

type JDbg struct {
	// contains filtered or unexported fields
}

JDbg is a wrapper around a JDWP connection that provides an easier interface for usage.

func (*JDbg) AllClasses

func (j *JDbg) AllClasses() []*Class

AllClasses returns all the loaded classes.

func (*JDbg) ArrayOf

func (j *JDbg) ArrayOf(elTy Type) *Array

ArrayOf returns the type of the array with specified element type.

func (*JDbg) BoolObjectType

func (j *JDbg) BoolObjectType() *Class

BoolObjectType returns the Java java.lang.Boolean type.

func (*JDbg) BoolType

func (j *JDbg) BoolType() *Simple

BoolType returns the Java java.lang.Boolean type.

func (*JDbg) ByteObjectType

func (j *JDbg) ByteObjectType() *Class

ByteObjectType returns the Java java.lang.Byte type.

func (*JDbg) ByteType

func (j *JDbg) ByteType() *Simple

ByteType returns the Java byte type.

func (*JDbg) CharObjectType

func (j *JDbg) CharObjectType() *Class

CharObjectType returns the Java java.lang.Character type.

func (*JDbg) CharType

func (j *JDbg) CharType() *Simple

CharType returns the Java char type.

func (*JDbg) Class

func (j *JDbg) Class(name string) *Class

Class looks up the specified class by name. For example: "java.io.File"

func (*JDbg) Connection

func (j *JDbg) Connection() *jdwp.Connection

Connection returns the JDWP connection.

func (*JDbg) DoubleObjectType

func (j *JDbg) DoubleObjectType() *Class

DoubleObjectType returns the Java java.lang.Double type.

func (*JDbg) DoubleType

func (j *JDbg) DoubleType() *Simple

DoubleType returns the Java double type.

func (*JDbg) FloatObjectType

func (j *JDbg) FloatObjectType() *Class

FloatObjectType returns the Java java.lang.Float type.

func (*JDbg) FloatType

func (j *JDbg) FloatType() *Simple

FloatType returns the Java float type.

func (*JDbg) GetArgument

func (j *JDbg) GetArgument(name string, index int) Variable

GetArgument returns the method argument of the given name and index. First, this attempts to retrieve the argument by name, but falls back to looking for the argument by index (e.g. in the case the names have been stripped from the debug info).

func (*JDbg) IntObjectType

func (j *JDbg) IntObjectType() *Class

IntObjectType returns the Java java.lang.Integer type.

func (*JDbg) IntType

func (j *JDbg) IntType() *Simple

IntType returns the Java int type.

func (*JDbg) LongObjectType

func (j *JDbg) LongObjectType() *Class

LongObjectType returns the Java java.lang.Long type.

func (*JDbg) LongType

func (j *JDbg) LongType() *Simple

LongType returns the Java long type.

func (*JDbg) NumberType

func (j *JDbg) NumberType() *Class

NumberType returns the Java java.lang.Number type.

func (*JDbg) ObjectType

func (j *JDbg) ObjectType() *Class

ObjectType returns the Java java.lang.Object type.

func (*JDbg) SetVariable

func (j *JDbg) SetVariable(variable Variable, val Value)

SetVariable sets the value of the given variable.

func (*JDbg) ShortObjectType

func (j *JDbg) ShortObjectType() *Class

ShortObjectType returns the Java java.lang.Short type.

func (*JDbg) ShortType

func (j *JDbg) ShortType() *Simple

ShortType returns the Java short type.

func (*JDbg) String

func (j *JDbg) String(val string) Value

func (*JDbg) StringType

func (j *JDbg) StringType() *Class

StringType returns the Java java.lang.String type.

func (*JDbg) This

func (j *JDbg) This() Value

This returns the this object for the current stack frame.

func (*JDbg) Type

func (j *JDbg) Type(sig string) Type

Type looks up the specified type by signature. For example: "Ljava/io/File;"

type Simple

type Simple struct {
	// contains filtered or unexported fields
}

Simple is a primitive type.

func (*Simple) Call

func (t *Simple) Call(method string, args ...interface{}) Value

Call invokes the static method with the specified arguments.

func (*Simple) CastableTo

func (t *Simple) CastableTo(ty Type) bool

CastableTo returns true if this type can be cast to ty.

func (*Simple) Signature

func (t *Simple) Signature() string

Signature returns the Java signature for the type.

func (*Simple) String

func (t *Simple) String() string

type Type

type Type interface {
	// String returns the string representation of the type.
	String() string
	// Signature returns the Java signature for the type.
	Signature() string
	// CastableTo returns true if this type can be cast to ty.
	CastableTo(ty Type) bool
	// Call invokes the static method with the specified arguments.
	Call(method string, args ...interface{}) Value
	// contains filtered or unexported methods
}

Type represents a Java type.

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value holds the value of a call.

func (Value) AsType

func (v Value) AsType() Type

AsType returns the value as a type.

func (Value) Call

func (v Value) Call(method string, args ...interface{}) Value

Call invokes the method on the value.

func (Value) Field

func (v Value) Field(name string) Value

Field returns the value of the specified field.

func (Value) Get

func (v Value) Get() interface{}

Get returns the value, unmarshalled.

func (Value) SetArrayValues

func (v Value) SetArrayValues(values interface{})

SetArrayValues sets the array values to values. This value must be an Array.

func (Value) Type

func (v Value) Type() Type

Type returns the value's type.

type Variable

type Variable struct {
	Value Value
	// contains filtered or unexported fields
}

Variable is a named Value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL