Re: Popping from operand stack
Paul Keeble <[email protected]> Mon, 17 Nov 2008 23:58:34 +0000 (GMT)
| Newsgroups | gmane.comp.jakarta.bcel.user |
|---|---|
| Message-ID | <[email protected]> |
Running the command iload_1 will put on the stack that integer, iload_2 wil= l do the same for the other integer. However where you choose to save them = affects massively what you do next! You might want to explain where you wan= t to store them and how.=0A=0AWriting out the code yourself in java as it w= ould look like after you have changed it and then looking at the byte code = will likely give you the answer you need in terms of what the byte codes ar= e to execute your intended storage plan. Amaziningly with BCEL you could ev= en back engineer the creation of that bytecode from BCEL.=0A=0ACan't be mor= e specific about the approach without some details and I think once you try= creating the java code and looking at the bytecode you will likely work ou= t what it is you need to do. Once you have that then its simply a question = of how to do that in BCEL!=0A=0APaul=0A=0A=0A----- Original Message ----=0A= From: Pranav Kuber <[email protected]>=0ATo: [email protected]= rg=0ASent: Monday, 17 November, 2008 23:21:55=0ASubject: Popping from opera= nd stack=0A=0AHi,=0A=0AI'm new to using BCEL and have a query.=0A=0AI'm try= ing to instrument all IF instructions. So I just need to find out a=0Away w= here I could access the operand stack constants (iload_1 and iload_2).=0A= =0AFor example, -=0Aif I have some code in this format=0A=0Aif(a!=3Db)=0A = do Something...=0Aelse=0A do something...=0A=0AThe corresponding byteco= de generated would be -=0A=0A 0: iload_1=0A 1: iload_2=0A 2: if= _icmpeq 16=0A 5: getstatic #2; //Field=0Ajava/lang/System.o= ut:Ljava/io/PrintStream;=0A 8: ldc #3; //String TRUE=0A............= as so on.=0A=0AI need to pop iload_1 and iload_2 from the stack and store = them somewhere.=0A=0AIs there any way I could do that?=0A=0AThanks for the = help.=0A=0ARegards,=0APranav=0A=0A=0A=0A