[prev in list] [next in list] [prev in thread] [next in thread] 

List:       soot-list
Subject:    Re: [Soot-list] How to use newStaticInvokeExpr() method for inserting methods with more than one arg
From:       "Steven Arzt" <Steven.Arzt () cased ! de>
Date:       2015-06-23 8:47:46
Message-ID: 005401d0ad91$47290c40$d57b24c0$ () cased ! de
[Download RAW message or body]

This is a multipart message in MIME format.

[Attachment #2 (multipart/alternative)]
This is a multipart message in MIME format.


Hi Marjan,

 

There is an overload of the newStaticInvokeExpr() method that takes a list of values \
as a parameter. Use this overload to create a static invocation expression with more \
than one argument.

 

Best regards,

  Steven

 

Von: soot-list-bounces@CS.McGill.CA [mailto:soot-list-bounces@CS.McGill.CA] Im \
                Auftrag von Marjan Radi
Gesendet: Montag, 22. Juni 2015 19:39
An: soot-list@cs.mcgill.ca
Betreff: [Soot-list] How to use newStaticInvokeExpr() method for inserting methods \
with more than one argument

 

Hi, 

 

I wanted to insert "Log.d(string s, string g)" statement in side my .dex file , using \
following code:

 

1- SootMethod toCall3 = Scene.v().getSootClass("android.util.Log").getMethod("int \
d(java.lang.String,java.lang.String)");  

2- b.getUnits().insertBefore(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr((SootMethodRef) \
toCall3.makeRef(), tmpLog)) ,srcUnit);

 

But I got the following error:

Exception in thread "main" Invalid number of arguments

at soot.jimple.validation.InvokeArgumentValidator.validate(InvokeArgumentValidator.java:35)


at soot.jimple.JimpleBody.validate(JimpleBody.java:117)

at soot.jimple.JimpleBody.validate(JimpleBody.java:102)

 

I know this error is because Log statement have two input parameters but in the \
second line of code there is only one parameter is mentioned ("tmpLog"). I do not \
know how to use "newStaticInvokeExpr" method for inserting methods with more than one \
argument. I would be appreciated if you could give me an example.

 

Best Regards,

Marjan 

 

 


[Attachment #5 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.E-MailFormatvorlage17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi \
Marjan,<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>There is an \
overload of the newStaticInvokeExpr() method that takes a list of values as a \
parameter. Use this overload to create a static invocation expression with more than \
one argument.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best \
regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>   \
Steven<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div \
style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p \
class=MsoNormal><b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Von:</span></b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> \
soot-list-bounces@CS.McGill.CA [mailto:soot-list-bounces@CS.McGill.CA] <b>Im Auftrag \
von </b>Marjan Radi<br><b>Gesendet:</b> Montag, 22. Juni 2015 19:39<br><b>An:</b> \
soot-list@cs.mcgill.ca<br><b>Betreff:</b> [Soot-list] How to use \
newStaticInvokeExpr() method for inserting methods with more than one \
argument<o:p></o:p></span></p></div></div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><div><div \
id="yui_3_16_0_1_1434745589928_111033"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>Hi,&nbsp;<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111033"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'><o:p>&nbsp;</o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111033"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>I wanted to insert &quot;Log.d(string s, string g)&quot; statement \
in side my .dex file , using following code:<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111033"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'><o:p>&nbsp;</o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111033"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>1- SootMethod toCall3 = \
Scene.v().getSootClass(&quot;android.util.Log&quot;).getMethod(&quot;int \
d(java.lang.String,java.lang.String)&quot;); &nbsp;<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111257"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>2- \
b.getUnits().insertBefore(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr((SootMethodRef) \
toCall3.makeRef(), tmpLog)) ,srcUnit);<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111103"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'><o:p>&nbsp;</o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111103"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>But I got the following error:<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111241"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>Exception in thread &quot;main&quot; Invalid number of \
arguments<o:p></o:p></span></p></div><div id="yui_3_16_0_1_1434745589928_111242"><p \
class=MsoNormal style='background:white'><span \
style='font-size:10.0pt;font-family:"Courier New";color:black'>at \
soot.jimple.validation.InvokeArgumentValidator.validate(InvokeArgumentValidator.java:35)<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111218"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>at \
soot.jimple.JimpleBody.validate(JimpleBody.java:117)<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>at \
soot.jimple.JimpleBody.validate(JimpleBody.java:102)<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'><o:p>&nbsp;</o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>I know this error is because Log statement have two input \
parameters but in the second line of code there is only one parameter is mentioned \
(&quot;tmpLog&quot;). I do not know how to use &quot;newStaticInvokeExpr&quot; method \
for inserting methods with more than one argument. I would be appreciated if you \
could give me an example.<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'><o:p>&nbsp;</o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>Best Regards,<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111192"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>Marjan&nbsp;<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111010"><p class=MsoNormal \
style='background:white'><span style='font-size:10.0pt;font-family:"Courier \
New";color:black'>&nbsp;<o:p></o:p></span></p></div><div \
id="yui_3_16_0_1_1434745589928_111008"><div \
id="yiv9426486400yui_3_16_0_1_1426188032239_18320"><div \
id="yiv9426486400yui_3_16_0_1_1426188032239_71660"><p class=MsoNormal \
style='background:white'><span \
style='color:black'><o:p>&nbsp;</o:p></span></p></div></div></div></div></div></body></html>




_______________________________________________
Soot-list mailing list
Soot-list@CS.McGill.CA
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic