6

Is it possible to output the current stacktrace with method signatures? I'm trying to debug some obfuscated code that has a ton of methods with the same name that just differ in arguments and return type.

Some things that will not work:

Thread.currentThread().getStackTrace();
new Throwable().getStackTrace();
// etc..
6
  • 1
    If it's obfuscated and you're debugging it, then either it's your code, and you should have an unobfuscated version somewhere, or it isn't, and you shouldn't be debugging it. Commented Nov 4, 2011 at 21:30
  • That's somewhat subjective, don't you think? Commented Nov 4, 2011 at 21:34
  • 4
    @JBNizet Meh, there are legitimate reasons to figure out issues in libraries that you don't have source for, obfuscated or not. Commented Nov 4, 2011 at 21:35
  • Obfuscating code is normally a way to make sure it's unreadable. So it's done to prevent anyone from reading it. Commented Nov 4, 2011 at 21:36
  • 1
    @JB Nizet: Obfuscating also allows to shrink the size. This used to be both very important and very common on the old J2ME apps for cellphones and some fully open libs were obfuscated just for the code size reduction. Some people probably still do it just for the code size reduction even though nowadays cellphones are much more powerful than when I used to work with them : ) Commented Nov 4, 2011 at 22:03

2 Answers 2

3

Nope, but you could instrument with AspectJ while troubleshooting to get more complete info without adding logging.

Depending on the nature of what you're trying to debug and how much you know about any data involved you might be able to target more or less precisely.

Sign up to request clarification or add additional context in comments.

Comments

1

Not possible. The stacktrace does't contain that info.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.