Run-as bug workaround
This page describes how to easily launch the Android gdbserver from your app using the framework provided by VisualGDB to work around the 'run-as: Package not found' bug. Before you begin, please install VisualGDB 5.1 or later.
- Open VisualGDB Project Properties and go to the Debug 
					Settings page. Select "Start gdbserver - Manually from the 
					app": 
- Go to the Makefile Settings page and add 
					"-DLAUNCH_GDBSERVER_FROM_APP" to both CFLAGS and CXXFLAGS. 
					Then add "-llog" to System Library Names: 
- 
					Press "OK". VisualGDB will add a file called 
					"gdbserver_launcher.c" to your project. Build the project 
					and ensure that the file is added to the LOCAL_SRC_FILES 
					field of the first loaded native library that you want to 
					debug: 
- Open the AndroidManifest.xml file and add the following 
					permission there:<uses-permission android:name="android.permission.INTERNET" /> 
- Now you can press F5 to start debugging your application 
					as usual. The following events will take place- Your app will be started.
- As soon as the library containing gdbserver_launcher.c will get loaded, the GDBServerInitializer() function marked with the 'constructor' attribute will get launched.
- GDBServerInitializer() will in turn call LaunchGDBServer() that will start listening to a socket and output the socket information to via the logcat mechanism
- VisualGDB will connect to the socket and send instructions on launching the gdbserver
- The LaunchGDBServer() function will actually launch the gdbserver and redirect its output to VisualGDB
- VisualGDB will automatically begin debugging
  
- If you encounter problems with gdbserver_launcher, check 
					the logcat view for errors reported by the launcher. 
					Normally it should only report the PID and the port of the 
					socket waiting for commands, however if it encounters any 
					problems, it will output them to the logcat window:
					 
