Author Topic: Debugging LAMW apps in real time - an idea  (Read 342 times)


  • Newbie
  • Posts: 1
Debugging LAMW apps in real time - an idea
« on: March 15, 2020, 05:38:58 pm »
I have an idea for a tool that should make it a lot easier to debug LAMW apps in real time, and I would like your feedback before I start.

The idea is this: a stand-alone program (or a window integrated into the IDE) that shows you, in real time, all the logcat strings that are generated when your app runs on an Android device.

Let's call it RTLM (Real-Time Logcat Monitor)

The way it works is simple in principle:

* Read the logcat from the device (Like LAMW tool "logcat -d [dump]") a few times each second.

* Every time, after reading the logcat, issue a "clear" command (Like LAMW tool "logcat -c [clear]") so that the same logs don't show up again next time.

* Filter the logs received, keeping only the logs related to your app.

* Show the filtered logs in a scrolling output window on the screen.

Additional features can include:

* Event type filter settings, so that, for example, you only show, or ignore, classes of logs such as warnings, errors, info, etc.

* Custom filter strings, so that, for example, you only see events matching a given string.

* Save the logs to file

Another powerful function that can be implemented is something similar to watches.

Although it is not possible to set real breakpoints, it is possible to have one or more real-time watches in this way:

* Let's say you need to debug some code, and you want to watch two properties, "A" and "B", in real time.

* In your source code, when you assign a value to A or B, you also add a log string with a certain structure, for example: "[WATCH:A=VALUE]" or "[WATCH:B=VALUE]" etc. where VALUE is the value assigned to that property or variable in that moment.

* The RTLM utility, every time it reads the logcat (a few times per second), looks for strings matching the above pattern [WATCH:NAME=VALUE] and updates a list of watches on the screen accordingly.

* As a result, while the app runs on the external device, on your computer screen you can see not only the almost-real-time list of generated events, but also an almost-real-time list of watches and their values.

What do you think of that?

Personally, the more I work with LAMW, the more I feel the need for something like that. I also searched online for similar tools, but could not find anything quite like that.

Do you know of any program that does something like that?

If something like that doesn't exist, do you think it would be useful?

If I am to go ahead and do it, the only thing I don't know is how to perform those two logcat commands: how to get the current logcat string from the device, and how to send the clear command.

So, if you think this is a good idea, and if you'd like to help me implement it, can you give me some suggestions, or better still, some example code, for reading and clearing the logcat?

I found some code in the amw_ide_menu_items.pas unit, but perhaps you have a better or easier solution, so I don't have to spend too much time on that, and can instead focus on the other features.

Of course, everything I'd do would be open source, that goes without saying.

Looking forward to your suggestions... cheers!!


TinyPortal © 2005-2018