Peripheral registers in Qt Creator during debugging - c++

I use Qt Creator to develop embedded application using Bare Metal configuration for STM32. When I debug this application under different IDEs like KIEL uVision, IAR System Workbench or some Eclipse IDE I have special view available where I can see processor specific registers in tree list. Is there something similar for Qt Creator?
I've seen the register view in debug view. Is there possibility to tell it which memory address to show?
EDIT: The application I'm writing is in C and C++. The target is microcontroller based on ARM architecture in this case STM32. There will be no Qt or QML code.
My goal is to use QtCreator as IDE for developing this application. This quite easy as you just configure the compiler (arm-none-eabi-gcc), debugger (arm-none-eabi-gdb) and gdb-server (openocd) in the kit configuration. This allows me to create executable elf file for bare metal target and then flash it to the FLASH memory inside the microcontroller.
All these steps are already done.
However the debugging part gets tricky as part of the memory space is direct hardware configuration and not pure memory. This memory space contains the configuration for the peripherals which allows you to e.g. talk over UART, I2C, ETHERNET, USB or just configure the pins or clock speed.
You need to look at these values and compare them with reference manual and see what each bit does. Currently it is possible to look at the memory map and read it there but Keil uVision, IAR System Workbench and Ecplipse based IDEs have nice plugin where you can see the values exactly as in the reference manual. (see the images)
So my question is if there is some plugin or some way how to view and edit these or if I have to write this plugin myself?
In the latter case I would need to know how to connect to the debugger instance and write commands and read output - mainly read data #address and write data #address. I understand that the gdb uses the MI mode. I tried to connect to gdb from different process but that is not possible so I guess that I'll have to create plugin for Qt Creator. The register description is in file format SVD which is XML with defined structure.
To summarize the last part I look for code that I have to implement in the plugin that will connect me to the running gdb and allow me to send and receive data when it hits breakpoint.

You don't say whether you are debugging C++ code or QML code, so I can't answer with a yes or no. Those register values are useful if you are debugging at the assembly language level (which in itself may or may not be useful).
If you're debugging C++ code, then you can configure your compiler to generate an assembly listing of that code, but you will be debugging at a pretty low level.
If you're debugging QML code, then you would need an assembly listing of the QML engine, which I doubt you will be able to get. More importantly, I suspect that it would be a waste of time to try to debug a declarative language like QML with such a low level procedural debugger. The point of a language like QML is to get you above all that.

Related

Shutting down fan c++ [duplicate]

Is there a Windows standard way to do things such as "start fan", "decrease speed" or the like, from C/C++?
I have a suspicion it might be ACPI, but I am a frail mortal and cannot read that kind of documentation.
Edit: e.g. Windows 7 lets you select in your power plan options such as "passive cooling" (only when things get hot?) vs. "active cooling" (keep the CPU proactively cool?). It seems the OS does have a way to control the fan generically.
I am at the moment working on a project that, among other things, controls the computer fans. Basically, the fans are controlled by the superIO chip of your computer. We access the chip directly using port-mapped IO, and from there we can get to the logical fan device. Using port-mapped IO requires the code to run in kernel mode, but windows does not supply any drivers for generic port IO (with good reason, since it is a very powerful tool), so we wrote our own driver, and used that.
If you want to go down this route, you basically need knowledge in two areas: driver development and how to access and interpret superIO chip information. When we started the project, we didn't know anything in either of these areas, so it has been learning by browsing, reading and finally doing. To gain the knowledge, we have been especially helped by looking at these links:
The WDK, which is the Windows Driver Kit. You need this to compile any driver you write for windows, With it comes a whole lot of source code for example drivers, including a driver for general port-mapped IO, called portio.
WinIO has source code for a driver in C, a dll in C that programmatically installs and loads that driver, and some C# code for a GUI, that loads the dll and reads/writes to the ports. The driver is very similar to the one in portio.
lm-sensors is a linux project, that, among other things, detects your superIO chip. /prog/detect/sensors-detect is the perl program, that does the detecting, and we have spent some time going through the code to see how to interface with a superIO chip.
When we were going through the lm-sensors code, it was very nice to have tools like RapidDriver and RW-everything, since they allowed us to simulate a run of sensors-detect. The latter is the more powerful, and is very helpful in visualising the IO space, while the former provides easier access to some operations which map better to the ones in sensors-detect (read/write byte to port)
Finally, you need to find the datasheet of your superIO chip. From the examples, that I have seen, the environment controllers of each chip provide similar functionality (r/w fan speed, read temperature, read chip voltage), but vary in what registers you have to write to in order to get to this functionality. This place has had all the datasheets, we have needed so far.
If you want something real quick to just lower fans to a level where you know things won't overheat, there's the speedfan program to do so. Figuring out how to configure it in the early versions to automatically lower fans to 50% on computer startup was so painful that my first approach was to simply byte-patch it to start the only superio managed fan I had at lower speed. The newer versions are still bit tough but it's doable - there's a graphical slider system that looks like audio equalizer except that the x axis is temp and y is fan speed. You drag them down one by one. After you figure out how to get manual control for the fan you want, this is next step.
There's a project to monitor hardware (like fans) with C#:
http://code.google.com/p/open-hardware-monitor/
I haven't extensively looked at it, but the source code and use of WinRing0.sys atleast gives the impression that if you know what fan controller you have and have the datasheet, it should be modifiable to also set values instead of just getting them. I don't know what tool is suited (beside kernel debugger) to look at what Speedfan does, if you preferred to snoop around and imitate speedfan instead of looking at the datasheets and trying things out.
Yes, It would be ACPI, and to my knowledge windows doesn't give much/any control over that from user space. So you'd have to start mucking with drivers, which is nigh impossible on windows.
That said, google reveals there are a few open source windows libraries for this for specific hardware... so depending on your hardware you might be able to find something.
ACPI may or may not allow you to adjust the fan settings. Some BIOS implementations may not allow that control though -- they may force control depending on the BIOS/CMOS settings. One might be hard-pressed for a good use case where the BIOS control (even customized) is insufficient. I have come across situations where the BIOS control indeed was insufficient, but not for all possible motherboard platforms.
WIndows Management Instrumentation library (WMI) does provide a Win32_Fan Class and even a SetSpeed method. Alas, the docs say this is not implemented, so I guess it's not very helpful. But you may be able to control things by setting the power state.

How can I 'break away' from Cocoa and develop Mac OpenGL applications in C/C++?

I am looking to get started with some 3D programming in C or C++. The problem I have is that it seems like the only tutorials I can find for Mac OS use objective C and Cocoa frameworks. I want to obtain the same environment as Windows users, more or less.
If I try to use a text editor and g++ compiler, I am missing headers, but, if I try to use Xcode, I am forced to grapple with Cocoa, which is frustrating to me. I don't really see any reason why the OpenGL/GLUT that comes pre-installed on Mac should force me to use Xcode, but it seems I can't get the header files without it.
How can I get through all of the Apple 'developer friendly' interfaces to write some old-fashioned code with full cross-platform portability?
Some portion of Objective-C is inevitable if you want to use the latest benefits of the OSX/Cocoa. The easiest way to port an existing application to MacOS would be the following:
Write the "bare bones" nibless application in Objective-C. It would only be a single AppDelegate class and a little setup in the main() function
Add the custom NSGLView descendant in your window which you create in the AppDelegate's didFinishLaunching event handler
Setup the CVDisplayLink and rendering callback in the NSGLView initialization
Use your existing OpenGL rendering code in the CVDisplayLink's callback
Now for the interesting part: where to get all of this ?
Surprisingly, a good nibless application sample is the UI for OSX's port of QEMU (yes, the emulator). Also the Apple's official GLEssenstialPractices demo shows all the information you need to set up OpenGL rendering pipeline. All the rest is up to you.
The detailed and modern introduction to system-level OSX programming can be found in the "Advanced Mac OS X Programming" book by Mark Dalrymple. It explains many things and after reading all of this I've understood most of the design decisions in the OS (it really makes you accept all the "non-standard" things if you think from the performance viewpoint).
To get through the "nibless" programming I would recommend you to read the blog posts like this one http://blog.kleymeyer.com/2008/05/creating-cocoa-applications-programatically-ie-nib-less/ The google search helps a lot.
The same tricks apply to the CocoaTouch/iOS and there are a lot of questions answered on SO, like this one Cocoa touch/Xcode - generating NIB-less graphics context
If you want to create cross-platform applications you could create a project with the Command Line Tool template.
Next, import the OpenGL and GLUT framework. This will get you a "blank" C++ project with the required OpenGL and GLUT headers.
Lighthouse 3D gives you some tips about portability and how to initiate your first project.
http://www.lighthouse3d.com/tutorials/glut-tutorial/initialization/
I have created a software layer (named cocoglut) that allows the translatation of basic or essential GLUT calls to COCOA. This library allows creating/destroying windows and register callbacks from a C/C++ application, just by using GLUT calls, without the need for nib files or for XCode project files (and can be compiled from the command line). This option uses full retina display resolution. The source is on GitHub.

Sending debug events to Windows debugger from external source

I have created a set of multi-platform C++ components to load and manage various types of digitally signed shared libraries. This handles all aspects of loading and initialziation including mapping them into the calling process, applying branch fix-ups, binding any imports and calling the initialization entry point. The components cannot use LoadLibrary() as it is platform specific and not all of the shared libraries are in PE format.
One of the few remaining issues I am faced with is providing appropriate debugger support for targeted platforms and development environments. In MS Windows environments this includes getting the debuggers to load symbol information generated by the compiler and linker (or converted from other source). Because the loading and initialization of the libraries occurs outside of the kernel, the debugger never receives LOAD_DLL_DEBUG_EVENT and UNLOAD_DLL_DEBUG_EVENT events. This leads to the following questions:
Is there an API or system call that allows events such as LOAD_DLL_DEBUG_EVENT to be sent directly to the debugger?
Is there a documented way to communicate directly with the program or session debug managers or with the machine debug manager service?
Is there an API or system call available to notify the kernel and subsequently the debugger that a DLL has been loaded? Since PE files are one of the primary supported formats this is the most desirable option. It also has the potential benefit of allowing the library to appear in the module list of the process.
Does the WinDBG SDK apply to debugging on Windows as a whole and can WinDBG extensions be used to instruct the debugger to load the symbol information?
I have search extensively for information on the above mentioned topics but have come up short. I have located a bit of information about the data structures used by the Windows debugger but nothing relevant to my specific situation.
I am open to API/system calls and approaches that are documented or undocumented and those requiring elevated privileges to function.
I don't think that there is a way to directly send the kind of events that you want (like LOAD_DLL_DEBUG_EVENT) to a process, at least not easily.
Why don't you simply wrap your libraries inside normal DLLs in Windows? Maybe you embed your custom module loading mechanism inside each "proxy" DLL, in this way you would not need to replicate so much functionality that the OS already provides for you.
If I understood the problem, you may see:
Writing a basic Windows Debuggers
Writing Windows Debugger (Detailed)

What's the best language for real-time graphics programming on Android?

Some googling has led me to believe that C++ is the best language for real-time 2D graphics programming, but since the Android is Java-based, is that still the best option? Or us the fact that I have to use NDK going to slow it down or something? My program also has a lot of scientific computing and I know C++ is best/fastest for that...
I've never done anything with the Android before so I'm really helpless right now. If I'm just going about it the wrong way, please give me other suggestions... Some other vocab I came across is OpenGL (which I have experience with, but that's more for 3D, right?) and Canvas (don't quite get this)? If I could get access to GPU-like capabilities that would be great.
Android applications are written Java, yes - however the Android NDK allows you to write performance-critical sections of your program in C or C++. From the Android NDK website,
The Android NDK is a companion tool to
the Android SDK that lets you build
performance-critical portions of your
apps in native code. It provides
headers and libraries that allow you
to build activities, handle user
input, use hardware sensors, access
application resources, and more, when
programming in C or C++.
That said, using the NDK appropriately will most likely not slow your program down.
OpenGL works for 3D and 2D graphics - if you're only interested in 2D you will want to look at using an Orthographic Projection - see glOrtho for more information. The Android Canvas, on the other hand, is the Java method for drawing raster graphics to the screen. It will let you render 2D graphics, but at a slower rate (and with frequent interruptions from the Android Garbage Collector).
Keep in mind that if you want to use C++, as of writing, there is no STL implementation available. There are, however unofficial ports that provide most of the functionality. STLPort is one that I have tried with some success. The biggest reason to move code to C/C++ is because of interruptions from the Android Java Garbage Collector - if you're not overly careful with your code, it will interrupt your program frequently to clean up objects you've left lying around. In practice this can limit game or simulation framerates drastically.
All that said, I would strongly recommend you look into one of the few open source android game engines that are cropping up. The best one I've tried is libGDX. It takes care of all the messy NDK details and lets you code your game / simulation purely in Java. It automatically runs the performance-heavy parts of the game engine in native code to get the fastest possible performance with the ease of coding in Java. Best of all, you can write your application code once and have it automatically run on Windows, Linux, OSX and Android - which makes testing your applications much, much easier than using the Android Emulator.
If you really want to look into the NDK yourself, or need to have really fine control on what OpenGL is doing, I would recommend you download the Android SDK and NDK, get eclipse set up, and then start with the NDK samples. There is an OpenGL demo there that shows you how to get everything set up. Another good starting point would be the SpinningCube google project.
EDIT: I'm not really sure if what you mean by 'GPU-like capabilities', but With libGDX, you can compile vertex and fragment shaders under OpenGL ES 2.0 - you could use this to run embarrassingly parallel code using the device's GPU.
You're making the assumption that the Android system will be too slow to do what you want, without any data to back that up. Write some tests in Java, and test out the performance first. You don't want to make assumptions about performance without any basis.
Premature optimization is the root of
all evil. - Knuth
How to do it: C-programmers guide to Java and JNI in Android
Good question, I put myself like 1½ years ago, found it very annoying. I feel a lot for you!
And because of this I like to give a hands on answer.
But look it is easy if you follow this guideline step by step (you will have much less struggle). I did it.
Learning this, you can in no time learn easily write Java Netbeans GUI with JNI apps (for any other OS) also, you are in the Java GUI JNI development world?
The basis is “knowing C/C++ very well, not knowing Java or Android programming at all, coming from for instance the Win32 SDK culture and making the first Android app”.
Android GUI is Java – you have to yield
Thing is that the GUI of Android is Java. Java like your app and the app is more or less in practice a piece of the GUI/OS environment completely integrated calling Java GUI SDK code all the time. The debugger even goes into the Java GUI SDK source code (feels like going off road, real odd for a Win32 SDK programmer).
In short, no way writing any Android apps, but in Java.
But it is pretty easy in anyway, you got the JNI
There are three very good shortcuts:
The Android sample library (is very rich), especially the Hello JNI sample is really important
The fact Java is in syntax very much alike C/C++ (but very different in its soul, read below, you need to understand)
You got the JNI C-code opportunity in doing the heavy work (and you major share of the code)
You have to write a small Java Android GUI user interface for your app (by thieving form samples) and the major part JNI, where you write your C/C++-code doing all the work.
Start with the Hello JNI sample program
Install Java and Android Studio and that it is all you need in tools (available in Win10, OSX or Ubuntu, they are the same).
Start Android Studio and its generic picture is a menu, select the lowest, Import an Android code sample.
The main sample program for a traditional C/C++ programmer is Hello JNI. Select it and say next to everything.
The Android Studio editor will open with the sample code (chews somewhat first see status line low).
Up to the right you (might need to push the Android tab to) see the content of your project Hello JNI, app. It consists of:
Manifests (app declaration, today of minor importance because most is now in Gradle script declarations (below))
Java tab for the Java files
Cpp-tab for your C-code files
Resources (texts, menus and icons)
Gradle compiling scripts
C-make-files
The Android studio might ask you for installation plugin upgrades, say yes to everything until it is done (see status line below).
Then run the Hello JNI sample code, to make certain your installation is OK
Pushing the green arrow in a cogwheel (mid top).
You get a dialogue box. Here you can try the sample on:
A physical Android device (via a cable from your PC, might need a Samsung win driver from their support)
A HAXM Android unit emulator (is reel good)
But you need to switch off the Hyper-V feature (used for XP emulation) in Win10 to make it run. Android studio might do it automatically for you asking, else control panel/Programs and functions/Windows functions.
Select Create new Virtual device. You might need to do some installation plugin upgrades more, say yes to everything.
When the Hello JNI app is working in the device, you have an OK installation.
C-code, check hello-jni.c
Look in the cpp-folder Up right) and you will find a C-file with a function.
Here and in any other C-file you can fill it with regular C-code.
Everything but the ANSI C locale features are supported (must get locale data from Java and transport them to the C-environment).
You need to edit the CMakeLists.txt file to add any additional C/C++-files (it is the makefile, look up to the right under the Gradle scripts).
Memory heaps, Java with JNI and C are different
You must be aware that everting in the data jstrings delivered by the JNI interface is located in the Java memory heap. This is also the case after the data has been in delivered C-format by JNI.
You will have fuzz if you don’t copy string data (and arrays) from the Java heap to the C-heap. Make a basic function like this to copy the data and release the JNI data:
char *GetStringfromJniString(JNIEnv *env, jstring jniString)
{
const char *TempString = (*env)->GetStringUTFChars(env, jniString, 0);
char *String = calloc(strlen(TempString) + 1, sizeof(char));
strcpy(String, TempString);
(*env)->ReleaseStringUTFChars(env, jniString, TempString);
return String;
}
When you send data to Java jstrings you need to contain it to the JNI transport by using the
return (*env)->NewStringUTF(env, pCstring);
Long funny names of the JNI-functions
The function name is Java_com_example_hellojni_HelloJni stringFromJNI(…).
There “Java” is always there
com_example_hellojni means it communicate with your app in the Java com.example.hellojni Java package (read about it in the tutorial)
The HelloJni is the name of the Java file the JNI function is declared
And stringFromJNI(…) is the actual function name (functions in Java are called Methods).
If naming is OK the declaration of the C JNI-functions in the Java file is black text, if not red text. (Give it a chance, it stores and checks the code continuously in the Java environment, might take a few seconds to verify it is right (becoming black).
You must declare the C JNI-functions in java
In the Java file here HelloJni.java the JNI-functions must declared as Java Methods (functions in Java).
public native String stringFromJNI(…);
Where return values and function/method switches are the same as in C.
After that you can use the JNI-functions as Java methods as they are declared in the Java declaration. Note that char * is String in java.
Constants must be declared on both sides
#define CONSTANT_A = 24
Is in Java
static final int CONSTANT_A = 24;
And you can use them in Java and in C as usually.
if(!variable) does not work in Java
You need to do
if(variable==0)
Test other samples
The sample library is full of fully nice functioning Java samples. Try them one by one until you find a user interface of your like. It is actually nice to test samples.
There are a lot of sample in Github but a lot of them need fixes of Gradle scripts or comes from Eclipse (the past Android dev environment) and is harder to try (often need fixes). Other Github sample are just fragments and a lot of work making them working. Of course nothing for a Java Android star but we are not there yet. But Github a very good even larger source of samples.
Copy the Java stuff into your Hello-JNI
Found anything nice, copy it!
Theft always pays as JS Bach used to do!
It is quite easy to just copy stuff from one sample to another. When copying in the Android studio, Android studio adds automatically the includes (asking first) and just accept. Sometimes it does it asking you to enter Alt-Enter, do it.
Editing several projects at the same time
The File/Open recent - Own windows-command, make you having two projects up at the same time, easier to copy stuff in between.
Making your own application
After some testing you create your own app.
Go to the generic Android studio picture (file/close project), select Start a new Android Studio project. Put your Package tree data (think that over, read about it in the tutorial) and create it. Then copy the stuff you tested to your own app.
Learn Java, the Android developer tutorial is real good
Now you have made your environment working and spotted some good user interfaces, learn Java!
The Android Studio tutorial is real good. Try it, and soon after a few lessons you will be able to play with Java code and very soon you are a Java programmer.
Getting stuck, google and you find most answers in Stackoverflow, just search.
You are never the first with a problem and Stackoverflow is real good. Read all the answers and think, you find what fits you best.
The Java environment and Android OS is very different from Windows
You need a feeling for the culture and environment. Like a Swede coming to Norway, the same food taste slightly different, even if it looks the same.
The major difference is that in Java nothing crash as good as in pure C in a C environment. Finding bugs can be hell because of non-consistent crashing. The program continue to run and crash later, but you find the bugs.
There are Java log files for debugging, but it takes quite an effort to penetrate it. Like learning the assembly code in a Windows debugger.
A good idea is to really debug the C-code in a pure C-environment first and handle the Java stuff in Android Studio.
I can amend C-code in Android Studio but writing a large chunk of C-code is really looking for troubles debugging it. Like asking a Norwegian make a Swedish dinner, impossible to get it right, looks the same but taste different. Nothing is wrong but different culture.
The soft crashing style of Java includes even security soft crash features like the try/catchy/finally stuff. (You have to google and read about it yourself. It is unbelievable for a hard core C-programmer, but it is real.)
There are no h-files and #if-compiler switches in Java
Instead of h-files and common declarations of functions/variables as in C in java you have to refer to them with a filename followed by a dot and the method name, using them from another file.
If declared private variables and methods can only be accessed from the same file, with public can be used with file reference. Static is something very different in Java.
There are no compiler #if-switches so you need to use regular variables/constants (for constants put final before in the declaration).
There are no pointers in Java, but there are strings
There are no pointers in Java but a String (and array) variable is in fact a char pointer
But you can’t handle pointers as in C with * and &, but in JNI you certainly can. The memory management is completely different, nothing is fixed in Java.
You don’t need to free data, Java wipes it all for you
Java cleans unused data automatically.
You don’t free data just delete (=0;) the string-“pointers” or just leave the method (Java function) and it cleans it.
So if you have a string pointer and just replace it with something else the old stuff is automatically wiped.
The Java environment lives its own life, but the Android studio debugger includes a monitor of the data used.
Size limitations of Java apps and JNI code
Good to know is that there are some restrictions in how large a Java app can be (but as usual nothing is written in stone in Java) but the JNI heap can be as large as the HW can take.
But you are not alone in a phone, an incoming call might come and you don’t want to mess that up? If you clean well it is a larger chance your app is intact returning to it and not killed.
Android apps don’t die by exit
If you exit an app, the app is still running even though the GUI is gone (like in Macintosh). Thing is that you have to be aware of that, read about it if you make serious apps.
Android kills apps
But on the other hand you can never trust that an app is not wiped by the OS and you have to rebuild. If the OS need memory it just starts to kill apps. But the JNI part usually survive and you can store data there for a recovery.
There is only one JNI instance (WinSDK term) but there might be many Java instances
And them all connect to the same JNI at the same time. Only one app instance can be active (shown) but the others might make background tasks. In JNI you need to keep track of them.
Normally there is only one Android instance of every app. But if you start the app by a work files from for instance like an email client, you in fact have another instance of the app (with its own memory and everything (but the JNI that is in only one common instance)).
Starting an appended file there will be two or more Android instances. Each related to each email instance, by the intents procedures (learn about intents in Android tutorial).
A smart thing is keeping track of the instances by number them when the app is created if savedInstanceState == null.
Copy data to the emulated unit
You might need to upload some data to test your app. In a regular phone you just attach the USB-cable and enter the Phone storage from Windows explorer. With the emulated units you must use the adb-terminal script functionality (can be used in bat-files in Windows and a copy bat file looks like this:
PATH=%PATH%;C:\Users\You\AppData\Local\Android\sdk\platform-tools
adb push C:\Users\You\Documents\v.txt /storage/emulated/0/Android/data/com.yours.app/files/v.txt
Very limited privileges to read and write files
Thing is however that you are only allowed to open your own files stored by your app in the emulated SD card. Else nothing comes reading them.
Use standard ANSI C file functions rather than Java
Best in a C-heavy app is to use standard C- file functions, as a C-programmer you are used to them and their behavior.
The C-file functions works fine and is easier to get binary code or transparent text files with ctrl-characters etc (Is not allowed in Java Strings but in java bit arrays). Take some effort learning Java file handling if you try that.
JNI performance is no issue
The C-code is much faster than the Java code so a lot of developers not from the C-culture must make JNI-functions and pure C-code to perform in heavy apps, needing performance. In short JNI performance is no issue.
However I have the impression that the Android GUI is faster than the WinSDK GUI in many cases. Working with ListViews and sometimes very long lists, Android is far better optimised. It looks like WinSDK is loading every line of the list, but Android only the lines visual, and in long lists it makes a huge difference.
I am impressed by performance in Android even with tiny ARM processors. Apps do perform very well. Intel Android units are real good in performance. I wouldn't hesitate trying to make a heavy duty app in Android, as long as I use JNI. Does not come short compared to Windows.
But notice, that running HAXM in an Intel PC the Intel emulated units runs much faster than the ARM than in real HW-units, because it runs intel code straight and not over an emulator layer as with ARM emulated units.
I am amazed that the Android x86 is not marketed heavier as a competitor to Windows on netbooks, for the common man, doing some documents, some calculations, email and Google? I believe the Crome OS is too alien for most people and most people have Android phones, feeling home. As a SW vendor I would like to see Android netbooks marketed much more and I would put more effort in SW development. Same thing with the Android TV without menus is closing the market for just the old Smart-TV approach. Something I can't understand having a boxed Win10 on the back of my TV since years, using a lot of programs there. The lack of Android graphics driver for the Raspberry-pie is also hard to understand, one with a regular Android would be smashing attached to the TV. In Sweden where I live, people under 40 don't watch aired TV, they stream, public service play, YouTube and Cable TV operators packages over internet. Having regular Android in the TV would generate usage of a lot of other apps. I see a market opportunity for SW vendors is closed. This when MS is making suicide with leased SW (normal people don't pay) mixing the culture of large accounts with the common man, a huge marketing window is opened. And the Android app performance is real good and nothing to worry about. It is not performance but marketing policies that limits the app market.
Quick you become a Java and Android master
You will be surprised how easy Java is for a C-programmer, doing it the right way (like following this guideline).
It might be slightly harder for a C++-programmer because the Classes in java and C++ culture looks to vary, might be easier to learn Java classes from scratch? But if you see C++-code in Win32 and OSX environment they look usually from different planets, so they might use to it.
The major disadvantage is that you wouldn’t get a diploma for your CV as doing a programmers course?

Debugging embedded Lua

How do you debug lua code embedded in a c++ application?
From what I gather, either I need to buy a special IDE and link in their special lua runtime (ugh). Or I need to build a debug console in to the game engine, using the lua debug API calls.
I am leaning toward writing my own debug console, but it seems like a lot of work. Time that I could better spend polishing the other portions of the game.
There are several tools floating around that can do at least parts of what you want. I have seen references to a VS plugin, there is a SciTE debugger extension in Lua for Windows, and there is the Kepler project's RemDebug, as well as their LuaEclipse.
RemDebug may be on the track of what you need, as it was built to allow for debugging CGI scripts written in Lua. It does require access to the LuaSocket module to provide a communications channel between the target script and a controller as well as a couple of other modules.
A bigger issue might be the ability to load arbitrary modules from within whatever sandbox the game engine has put around your scripts. If you have some control over the engine, then that won't be as big an issue.
This isn't currently possible for developers of Adobe Lightroom plugins, for example, because Lightroom does not expose require inside the plugin's sandbox.
A surprise to me has been how rarely I have felt a need for a debugger when working with Lua. I've built several small applications in it for various projects and have been surprised at how well a combination of complete stack backtraces and the occasional print call works to locate the bugs that require "strict" didn't prevent in the first place.
How about Decoda?? there is a video that explains how to use it, and it works pretty darn well for embedded lua source. (i am a happy customer). and it's pretty cheap.
You don't need to write your own console as you may want to start with one of the existing ones. RemDebug has already been suggested; I have been developing MobDebug, which is a debugger based on RemDebug, but with a host of new features and bug fixes. The detailed list of the changes is in the README.
Enabling debugging in your script may be as simple as adding require('mobdebug').start() (if you are running your app and the debugger server on the same machine). This should try to connect to the debugger listening on a default port on localhost. You can use a command-line interface included in MobDebug, or you can use a ZeroBrane Studio, which is a Lua IDE that integrates with MobDebug to provide debugging capabilities. The IDE supports debugging for Love2d, Moai, and other Lua engines and may well work for your set up too.
You can use my debugger: GRLD (graphical remote lua debugger). Like RemDebug it uses a socket connection, but unlike RemDebug it has a nice graphical interface. The source code is provided, so you can make it work on any platform. It works with the standard lua runtime. Free of charge for non-commercial use.
EDIT: sorry, I had to close the website, so the software is not available for download anymore. I might release it as open source software later, if I ever find the time.
EDIT 2: link updated, now hosted in github under the MIT license (open source)
I don't see how calling DebuggerBreak should work, since that is .NET specific. I would assume that only works with the forked Lua targeting the CLR.
If you are using standard Lua you have some rudementary debugging facilities through the lua function call debug.debug(). That will throw Lua into your console, so if you are running lua from a console, you should be able issue lua commands interactively to inspect your current state. debug.debug() wont put you into the current stack frame, so you have to use debug.getlocal() to read the values of your variables.
I haven't tried it myself yet, but I actually don't think making your own workable debug console is that much work. Remember Lua is not as complicated language as C++, so doing this is a lot easier than making a real C++ debugger like say gdb.
I think there are a lot of people who have done similar things already, whos code you could look at. Here is CLI debugger written in only lua. Just one lua file. Shouldn't be to hard use and modify for your needs.
If you are using windows and VS - Can you use the trick we use?
Copy the lua code in a file. Then in the lua code make a call to the Debugger api (in C++ this is DebuggerBreak() I think - see here). then when the lua code executes the debugger will fire up and you should be able to specify the file. Then debug as normal?