Open derekbruening opened 9 years ago
From zhao...@google.com on March 02, 2013 11:01:57
drwrap_get_arg only gets inlined argument using the C calling convention, e.g. int, pointer. To get complex argument like float or struct, you have to know the symbol/type of the argument, and how they are passed.
From bruen...@google.com on March 11, 2013 10:04:15
Summary: add complex type support to drwrap_get_arg (was: About drwrap_get_arg)
Labels: Component-API
Xref https://groups.google.com/g/dynamorio-users/c/7L8aVtfifVM/m/nSZlfOUTAAAJ
Pasting from there regarding adding floating point argument support:
What you need to do is look up the calling convention for your platform and figure out how floating-point parameters are passed. If it's x86-64 it should be in the xmm registers. It is not possible to get a float arg value from an integer arg value as you will see when you look at the convention as they are in completely different registers.
It would be great if you could contribute the code to do this by sending a pull request. You can see the integer code at https://github.com/DynamoRIO/dynamorio/blob/master/ext/drwrap/drwrap.c#L705. There would have to be a parameter type interface added with a dispatch on type.
From loveker...@gmail.com on March 02, 2013 12:28:42
typedef struct { int a; float b; }TTT; int xxxtest(int go, char *mm, float f, TTT ttt) { printf("dll step1...\n"); return 0xface; }
int p0 = (int) drwrap_get_arg(wrapcxt, 0);[OK] char * p1 = (char *) drwrap_get_arg(wrapcxt, 1); [OK] float p2=(float)drwrap_get_arg(wrapcxt, 2); [ERROR, HOW?] TTT p3 = (TTT)drwrap_get_arg(wrapcxt, 3); [ERROR, HOW?]
How to solve this problem? How to get the arg[2]、arg[3]?
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=1104