0

Suppose we want to use debugger on certain source file of the application by setting breakpoints, so until those breakpoints are hit we can not start debugging. My question is how can we know what interaction we should perform with the application in execution from start so that we reach to the point to execute lines under breakpoints. If application has too many source files we can not find this path manually.

1
  • 1
    This is a really open-ended question and really needs more detail. If you're debugging something, then I guess you know there is a bug and if there is a bug, you should know the steps to reproduce the bug. If the code crashes, and you have a stack trace from the crash, then you should be able to pinpoint the class to debug. All the same, if you are debugging some specific piece of code, you ought to know the steps to trigger that code path. Commented Feb 5, 2018 at 11:53

2 Answers 2

1

The most simple way is to ask your developer. Because otherwise it looks like a sort of reverse engineering.

If asking a developer is not an option I would suggest the following way:

Your application likely produces some logs. While performing some regular user interaction, watch them and then look for the informational text in your sources. This will give you a clue where to find the code that is being currently executed. Some logging framework also let you output the concrete places in the code this particular line is logged out from.

Search for text over all your sources (or use other relevant information taken from log files). Find the most relevant one. Analyse the code to learn the business logic it implements or some entry points which can be called from other parts of code (other classes or whatever). Set up breakpoints to all such the places.

One of those breakpoints should catch your user path.

0

If debugging is too complex or the developers are too busy then you could make a build of the application with asserts in it just before branches , these asserts can then exit with a given message and can usually be traced to a code line number, you could smuggle some data out that way as well if you don't have access to logging.

Depending on how your project is set up you might have build rules that filter out asserts so check this if it isn't working.

This should allow you to map your progress through the logic tree of your application although it will be time consuming if your builds take a long time.

Not the answer you're looking for? Browse other questions tagged or ask your own question.