On Apr 24, 3:10 pm, kemofish <[email protected]> wrote:
> I'm guessing the "stack" tool uses addr2line as described by Jorge
> below but it goes through the logcat output, finds the crash log
> entries, and does the addr2line conversion.
>
> Does "stack" exist or is it an Android myth???

vendor/google/tools/stack exists, but isn't part of the published
sources.  It has some google-internal build server stuff to make it
easier for us to grab the symbol files from specific releases.

We can't release it unless somebody runs through and deletes all the
google-specific goodies, which must be done without breaking anything;
so far that hasn't happened.

The key bit is this (python):

# Copyright (C) 2008 The Android Open Source Project
# License at http://www.apache.org/licenses/LICENSE-2.0

# returns a list containing the function name and the file/lineno
def CallAddr2Line(lib, addr):
  uname = os.uname()[0]
  if uname == "Darwin":
    proc = os.uname()[-1]
    if proc == "i386":
      uname = "darwin-x86"
    else:
      uname = "darwin-ppc"
  elif uname == "Linux":
    uname = "linux-x86"
  if lib != "":
    cmd = "./prebuilt/" + uname + \
        "/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line" \
        + " -f -e " + SYMBOLS_DIR + lib \
        + " 0x" + addr
    stream = os.popen(cmd)
    lines = stream.readlines()
    list = map(string.strip, lines)
  else:
    list = []
  if list != []:
    # Name like "move_forward_type<JavaVMOption>" causes troubles
    mangled_name = re.sub('<', '\<', list[0]);
    mangled_name = re.sub('>', '\>', mangled_name);
    cmd = "./prebuilt/" + uname + "/toolchain/arm-eabi-4.2.1/bin/arm-
eabi-c++filt "\
          + mangled_name
    stream = os.popen(cmd)
    list[0] = stream.readline()
    stream.close()
    list = map(string.strip, list)
  else:
    list = [ "(unknown)", "(unknown)" ]
  return list

where uname is usually "linux-x86".  Wrap the above in a loop and just
paste in the necessary bits, or make a smarter script that
automatically finds the start of the stack trace.

There was a change-up somewhere along the way between relative and
absolute addresses that can be worked around by zeroing out the high
12 bits.  The stuff posted earlier in this thread appeared to be
relative, so you may not have to worry about it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to