You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Dean Hiller <de...@xsoftware.biz> on 2005/01/14 05:01:52 UTC

how to use bcel to tell if class was compiled with -g option?

What is an easy way to programatically tell if the class file was compiled with javac's -g option?

In particular, if I have this code

public void method() {
        FakeClass c = null; 
        //or something like below....
        FakeClass c = Factory.create();
}

With debug on, visitLocalVariable is called, when the class is compiled without it on, visitLocalVariable is not called, but is there an easier way to tell this like when I get all the instructions from the method, could I go through and look for an one of these...

aconst_null[1](1)
astore_1[76](1)

And if I find one, what would I do?

thanks for any help on this.  This is my last hurdle,

thanks,

dean

Re: oops, didn't work.....how to use bcel to tell if class was compiled with -g option?

Posted by Dave Brosius <db...@qis.net>.
Code.getMaxLocals()


----- Original Message ----- 
From: "Dean Hiller" <de...@xsoftware.biz>
To: "BCEL Users List" <bc...@jakarta.apache.org>
Sent: Saturday, January 15, 2005 2:22 PM
Subject: oops, didn't work.....how to use bcel to tell if class was compiled 
with -g option?


> Question...How do I tell if there are local variables before looking for a
> LocalVariableTable?
>
> oops, actually, it didn't seem to work as I think some methods don't have 
> a
> LocalVariableTable probably because they have no local variables....I 
> guess
> I actually need to find out if there is local variables(how do I do this?)
> and then look for a LocalVariableTable.  If the LocalVariableTable is null
> when there are local variables present, I then know -g was not used on 
> that
> file....If there are no local variables in the file, I actually don't care
> if -g wasn't used then.
>
> thanks,
> dean
>
>
> ----- Original Message ----- 
> From: "Dave Brosius" <db...@qis.net>
> To: "BCEL Users List" <bc...@jakarta.apache.org>
> Sent: Thursday, January 13, 2005 9:13 PM
> Subject: Re: how to use bcel to tell if class was compiled with -g option?
>
>
>> iirc, From the visitCode(Code obj), you can call on the code object
>>
>> getLineNumberTable()
>> getLocalVariableTable()
>>
>> if these two return non null objects, then -g was probably used.
>>
>>
>> From: "Dean Hiller" <de...@xsoftware.biz>
>> To: "BCEL Users List" <bc...@jakarta.apache.org>
>> Sent: Thursday, January 13, 2005 11:01 PM
>> Subject: how to use bcel to tell if class was compiled with -g option?
>>
>>
>> What is an easy way to programatically tell if the class file was 
>> compiled
>> with javac's -g option?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


oops, didn't work.....how to use bcel to tell if class was compiled with -g option?

Posted by Dean Hiller <de...@xsoftware.biz>.
Question...How do I tell if there are local variables before looking for a
LocalVariableTable?

oops, actually, it didn't seem to work as I think some methods don't have a
LocalVariableTable probably because they have no local variables....I guess
I actually need to find out if there is local variables(how do I do this?)
and then look for a LocalVariableTable.  If the LocalVariableTable is null
when there are local variables present, I then know -g was not used on that
file....If there are no local variables in the file, I actually don't care
if -g wasn't used then.

thanks,
dean


----- Original Message ----- 
From: "Dave Brosius" <db...@qis.net>
To: "BCEL Users List" <bc...@jakarta.apache.org>
Sent: Thursday, January 13, 2005 9:13 PM
Subject: Re: how to use bcel to tell if class was compiled with -g option?


> iirc, From the visitCode(Code obj), you can call on the code object
>
> getLineNumberTable()
> getLocalVariableTable()
>
> if these two return non null objects, then -g was probably used.
>
>
> From: "Dean Hiller" <de...@xsoftware.biz>
> To: "BCEL Users List" <bc...@jakarta.apache.org>
> Sent: Thursday, January 13, 2005 11:01 PM
> Subject: how to use bcel to tell if class was compiled with -g option?
>
>
> What is an easy way to programatically tell if the class file was compiled
> with javac's -g option?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: how to use bcel to tell if class was compiled with -g option?

Posted by Dean Hiller <de...@xsoftware.biz>.
sweet, thanks, you rock.  My little open source ant task is complete.
thanks,
dean

----- Original Message ----- 
From: "Dave Brosius" <db...@qis.net>
To: "BCEL Users List" <bc...@jakarta.apache.org>
Sent: Thursday, January 13, 2005 9:13 PM
Subject: Re: how to use bcel to tell if class was compiled with -g option?


> iirc, From the visitCode(Code obj), you can call on the code object
>
> getLineNumberTable()
> getLocalVariableTable()
>
> if these two return non null objects, then -g was probably used.
>
>
> From: "Dean Hiller" <de...@xsoftware.biz>
> To: "BCEL Users List" <bc...@jakarta.apache.org>
> Sent: Thursday, January 13, 2005 11:01 PM
> Subject: how to use bcel to tell if class was compiled with -g option?
>
>
> What is an easy way to programatically tell if the class file was compiled
> with javac's -g option?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: how to use bcel to tell if class was compiled with -g option?

Posted by Dave Brosius <db...@qis.net>.
iirc, From the visitCode(Code obj), you can call on the code object

getLineNumberTable()
getLocalVariableTable()

if these two return non null objects, then -g was probably used.


From: "Dean Hiller" <de...@xsoftware.biz>
To: "BCEL Users List" <bc...@jakarta.apache.org>
Sent: Thursday, January 13, 2005 11:01 PM
Subject: how to use bcel to tell if class was compiled with -g option?


What is an easy way to programatically tell if the class file was compiled 
with javac's -g option?



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org