1998-12-04 00:10:47 +03:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-02 09:38:29 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-12-04 00:10:47 +03:00
|
|
|
*
|
1999-11-02 09:38:29 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-12-04 00:10:47 +03:00
|
|
|
*
|
1999-11-02 09:38:29 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-12-04 00:10:47 +03:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-02 09:38:29 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-12-04 00:10:47 +03:00
|
|
|
*/
|
|
|
|
public class Disass
|
|
|
|
{
|
|
|
|
final static int SUCCESS = 0;
|
|
|
|
final static int UNKNOWN_STUB = 1;
|
|
|
|
final static int METHOD_NOT_FOUND = 2;
|
|
|
|
final static int CLASS_NOT_FOUND = 3;
|
|
|
|
|
|
|
|
public native int disassemble(String className, String methodName, String signature);
|
|
|
|
|
|
|
|
Disass()
|
|
|
|
{
|
|
|
|
System.loadLibrary("Disass");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String argv[])
|
|
|
|
{
|
|
|
|
if (argv.length != 3) {
|
|
|
|
System.out.println("usage: Disass <ClassName> <MethodName> <Signature>");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Disass disass = new Disass();
|
|
|
|
|
|
|
|
switch (disass.disassemble(argv[0], argv[1], argv[2])) {
|
|
|
|
case SUCCESS:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UNKNOWN_STUB:
|
|
|
|
System.out.println("Was unable to compile the method (unknown compile stub)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case METHOD_NOT_FOUND:
|
|
|
|
System.out.println("Found the class " + argv[0] + " but cannot find the method "
|
|
|
|
+ argv[1] + argv[2] + ".");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CLASS_NOT_FOUND:
|
|
|
|
System.out.println("Cannot find the class " + argv[0] + ".");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void test(int a)
|
|
|
|
{
|
|
|
|
int j = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 100; i++) {
|
|
|
|
j += i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|