[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Line numbers for SootMethod, SootField, SootClass



Hi!

I just wanted to know if it is somehow possible to extract line numbers
for the objects stated above? I already tried by applying getTags() and
looking for a LineNumberTag. But all these objects do not seem to have a
tag.

Here the code I used:
--
  /**
   * extract the Soot line mumber if given
   * @param sootObject the SootClass, SootMethod or SootField whose
linenumber should
   * be extracted
   * @return the appropriate line number or -1 if there ws no number
found
   */
  public static int extractLineNumber(AbstractHost sootObject) {
    int line = -1;
    for (Iterator j = sootObject.getTags().iterator(); j.hasNext() &&
line<0; ) {
      Tag tag = (Tag)j.next();
      if (tag instanceof LineNumberTag) {
        byte[] value = tag.getValue();
        line = ((value[0] & 0xff) << 8) | (value[1] & 0xff);
      }
      System.out.println(tag.getClass().getName());
    }
    return line;
  }
--

It always returns -1 and sootObject.getTags().size() is always 0 :-/

Thanks,
Eric

------------------------------------------------------------
Eric Bodden
University of Kent at Canterbury