This is something I would also like. Mayur mentioned to me once that
there's a slightly-cumbersome way to do it. I discovered that for my
purposes, I didn't really need it. Line numbers, which are easy to
get, turned out to be more useful.
Here's some background that may be helpful:
The elements in the V domain don't correspond one-to-one with
variables. Internally, they're called "registers".
The ones numbered with a "T" generally correspond to unnamed
temporaries in the source code.
The ones named with R often, but don't always, correspond to named values.
Another relevant fact is that internally, JChord transforms methods
into what's called static-single-assignment form. This means it adds
additional temporaries to make sure that each variable is assigned a
value in exactly one place. So if you have code like a = 5; a*=2; a =
a+b; you'll get three different registers that all hold values for
'a'.
--Ari
> --
> You received this message because you are subscribed to the Google Groups "chord-discuss" group.
> To post to this group, send email to chord-...@googlegroups.com.
> To unsubscribe from this group, send email to chord-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/chord-discuss?hl=en.
>
--
Ari Rabkin asra...@gmail.com
UC Berkeley Computer Science Department
The things I usually care about are "where did the value that's set on
line XYZ come from?" And that's comparatively easy to do.
Every value in V is assigned a value in exactly one quad. Mapping from
quads to source lines is easy. So you can say, pretty easily, "the
variable that's given a value on line XYZ is pointing to the object
allocated on line ABC".
--Ari
> --
> You received this message because you are subscribed to the Google Groups
> "chord-discuss" group.
> To post to this group, send email to chord-...@googlegroups.com.
> To unsubscribe from this group, send email to
> chord-discus...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/chord-discuss?hl=en.
--
If I understand well, you mean
---- From an element of type chord.analyses.var.DomV
you can derive an element joeq.compiler.Quad,
---- and from joeq.compiler.Quad, you can get its corresponding
line number (of type int) in the analysed bytecode.
Sorry but I am not that familiar with the API of jchord. Would you
like to indicate how do you achieve the 2 steps in Chord?
Thanks.
Zell.
This part is a bit messy. What I had in mind was iterating over the
quads in a method and looking at the destination register.
> ---- and from joeq.compiler.Quad, you can get its corresponding
> line number (of type int) in the analysed bytecode.
You can just call Quad.getLineNumber();
Note that this is the line number in the original source code, NOT a
bytecode offset or anything like that.