Google NaCl on OS X: How do I get any debugging information at all? - google-nativeclient

Having compiled and linked a NaCl module I am now attempting to debug why it seemingly won't run. Unfortunately the platform is not passing on ANY information about why nothing is happening.
I can't believe I'm asking something this basic but what do you have to do to get a single printf() statement to appear in stdout/stderr? Or in the Javascript console?
Yes I've read the SDK page about Debugging and enabled all the dozens of environment variables and flags, I've turned the logging verbosity up to max, and absolutely none of it makes the blindest bit of difference. No information whatsoever appears anywhere.
Occasionally the JS console will print the line "ServiceRuntime::Start (start failed)" (which also appears in stdout) but it's far more often that I get nothing at all.
NaCl SDK version is 28, am running Chrome 30 on OS X Mavericks.
Command used to start Chrome with the Graphics 3D example in the SDK:
export NACL_EXE_STDERR=~/nacl_stderr.log
export NACL_EXE_STDOUT=~/nacl_stdout.log
open -a "Google Chrome" http://localhost:5103/api/graphics_3d/ --args --enable-logging --no-sandbox --vmodule=ppb*=4
This should generate a ton of logging but the log files are never created.

As discussed on the mailing list, the solution is to make sure you invoke chrome (e.g. from the command line) using the actual path to the Chrome binary (for example, "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome") instead of using the open shell command, because open does not give you the stdout/stderr streams from the application it launches.

Related

Julia REPL -- Legacy Console Mode Issue

I've had trouble using Julia in Windows Terminal for the last few releases because the ANSI escapes refuse to render properly unless I enable Legacy Console Mode which helps in CMD prompts, but not in Windows Terminal.
When launched in Terminal, it looks like this:
When launched with --color=no, it looks like this:
Which is marginally more useful, but both the inputs and outputs are muddled by the ANSI escapes, which makes the REPL effectively useless.
My workaround has been to enable the "Legacy Console" and use an alias to launch julia in a separate CMD-based window when I need REPL functionality, but this is disruptive.
I have tried various combinations of (multiple releases of) Windows Terminal (stable and dev), Powershell (stable and dev), and Legacy Console mode. There must be a configuration issue on my machine that I just can't nail down because no one else seems to have this issue.
What am I missing?
Can you file this over at https://github.com/microsoft/terminal/issues?
By all accounts, this should work. Seeing the literal escapes in the buffer like that makes me think that Julia isn't enabling ENABLE_VIRTUAL_TERMINAL_PROCESSING, which they would need for escape sequences to work. Though, if you're on a version of julia from 2021, I would presume that they're aware of that and would be setting that mode by now. (That flag was added in like, 2016)
Hopefully we can help diagnose more over at the Terminal repo ☺️

When does System.out not appear in the Java console?

I understood that anything to standard out (System.out) would appear in the Java Console window (when it's enabled). I spotted somewhere though that there might be situations where this isn't try, for example, from Swing apps. Is that the case?
Basically, what situations or setups wouldn't I expect to see standard output in the console? Is there a difference in behavior running on the JDK rather than explicitly on the JRE for example? javaw.exe?
ps, I understand how to display the Console in the Java settings but I'm curious as I've managed to create an application, run as an executable jar, that doesn't start the console despite some calls to System.out) on Windows 7.
The only way you wouldn't see System.out output in the console is if the method System.setOut has been invoked. This method is invoked to redirect output to the graphical Java Console, but I don't know of any other realistic circumstance in which it would be redirected away from the Java Console unless you do so voluntarily.
Depending on terminal settings it can happen that the output is not written until a newline character is sent as well. So if you do System.out.print("test") it might not appear immediately.
On Windows this is usually not the case, but on Unix terminals this is quite common.
Perhaps you use javaw to start virtual machine, this version will not show console messages. You can use java to start the virtual machine, which will show the console message.
javaw is intended for apps with windows, java is intended for console apps.
Same thing happened to me. I could not get System.out.println or Logger.debug either on console.
If you are on a huge project in Eclipse or whatever, you can read below.
Solution: I realized that I had not committed jars and some java files to SubVersioN on network. thats all. Project had not been compiled.
One situation I can think of is to invoke System.setOut(null) (orSystem.setOut(any OutputStream other than System.out or System.err)) then the console, if exists, would show nothing.

Qt IDE c/c++Debugger mode is Very Slow?

I'm using the Qt for developing the c/c++ application,while i try to debug the app with static library it is very slow and takes much time step over (r) in..
can any one suggest me to make the debugger fast as like vs2008..
regards
VS
It is likely you are having this behaviour because the debugger retrieves required debug info for system libraries from the internet each time - or it doesn't find the requested info at all. If so, it will display something like that in the Debugging Window.
Follow these steps to set up a symbol cache which will allow caching debug symbols:
http://doc.qt.io/qtcreator/creator-debugger-engines.html#setting-cdb-paths-on-windows
This might still make it slow for the next time you debug, but it should get quite fast from the second time on.
If you do not have internet access though, you will need to manually download these symbols from here:
http://msdn.microsoft.com/en-us/windows/hardware/gg463028.aspx
and place them in the symbol cache folder you specified.
it has nothing to do with windows and debug symbols server
this is happening when libqt has debug symbols and it happens even (directly) in gdb/cgdb!
it has to do with dwarf (still looking into this one)
regressed on windows (8), ubuntu (13.04), fedora (19-rc) & mac (10.8.5 & 10.9) -> obviously has little to do with os or library

Samples don't work in Google NaCl rev 18

I'm trying to use the latest Google NaCl SDK. Following the instructions at https://developers.google.com/native-client/pepper18/devguide/tutorial
I downloaded the naclsdk tool from their site, ran update, and got a pepper_18 folder.
I set NACL_SDK_ROOT to the pepper_18 folder, went in to 'examples' and ran make. Everything seemed to compile just fine.
I started Chrome, looked in about: flags and about: plugins, and verified that NaCl is enabled. I installed the SDK Examples app (from: https://developers.google.com/native-client/pepper18/sdk/examples) and that works just fine.
Then I tried to run my locally built and hosted examples, going to http://localhost: 5301. The HTML loads fine but the NaCl content does not load. In the hello world examples, it says "Status: LOADING..." forever.
I double checked the HTTP server logs and I don't see any errors there. Is there another place I should be looking for logged errors?
Check for version mismatch
In Chrome navigate to about:version and check that the major version of Chrome is at least that of the Pepper version you used to build your examples.
Check the JavaScript console in Chrome for any errors
You can find it by clicking the wrench icon in the upper right-hand corner in Chrome and selecting Tools -> JavaScript Console.
Inspect the NaCl module for further information
In the JavaScript console, you can also inspect the embed element of the NaCl module. E.g., if the embed tag has id="nacl_module" you can inspect it by typing
theModule = document.getElementById('nacl_module');
theModule.lastError;
Check Chrome's output to stdout/stderr
On Mac or Linux start Chrome from the terminal and look at the output on the console. E.g., on the Mac, you'd typically go
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-nacl
On Windows, Chrome does not write to the terminal if started from a command prompt. For this reason you need to redirect stdout/stderr from Chrome by setting the environment variables NACLLOG, NACL_EXE_STDOUT, and NACL_EXE_STDERR. Point them to different files, e.g.,
NACLLOG = c:\my_project\nacl.log
NACL_EXE_STDOUT = c:\my_project\nacl_stdout.log
NACL_EXE_STDERR = c:\my_project\nacl_stderr.log
Then (re-)start Chrome (making sure these environment variables are in effect).
Connect a debugger
Instructions on using the debugging support (currently only 64-bit Windows and 64-bit Linux) are available at https://developers.google.com/native-client/pepper18/beta-docs/debugging.
Restarting Chrome means closing all windows
When developing for Native Client one often restarts Chrome. It is important to close all Chrome windows; otherwise it hasn't actually restarted.
I muddled through a few issues which I will document in case they help others:
Neglected to 'make' the examples (got a clue to make them from the asker's description).
Chrome would not let me run non-store chrome apps. Went to chrome://flags and enabled Native Client and Native Client GDB-based debugging.
The JavaScript console said the demo's nmf file under .../debug/ was missing. I changed the make config to build Debug instead of Release based on this.
Chrome console complained NativeClient: NaCl module load failed: ServiceRuntime: failed to start; NaCl's GDB debug stub requires --no-sandbox flag on Windows. See crbug…. Tried running Chrome from cmd with --no-sandbox. This results in an alert You are using an unsupported command-line flag: --nosandbox. Stability and security will suffer. The aforementioned error went away, but the examples still would not run - no UI.
Went back to chrome://flags and disabled Native Client GDB-based debugging.
Then most of the examples worked. The Google Drive demo complains Error: must be run as a packged app.
have you confirmed that you've run httpd.py from the examples folder? This script creates the localhost:5103 server that the apps can be ran from.
Also, what OS are you using?
~Main

how to debug swf browser crashes

My swf is occasionally crashing the browser (or just crashing the plugin as chrome tells me).
How do I diagnose the bug? I am developing for flash player 9 using flex.
Things I have tried:
Turned on log files so I can see trace("...") output. However, my log files, and my swf, are ending at inconsistent termination points.
Install the debug version of the flash player
Tried different browsers (today I am on vista, and can reproduce the bug on four browsers).
I am hoping there is a [legible] stack trace from the plugin. Any suggestions?
It's likely that the flash plugin is causing the crash before your log files can be flushed. The only thing I can recommend is to install the Windows Debugging Tools.
Then bring up a command prompt (as administrator if in vista), and type the following:
cd "%programfiles%\Debugging Tools for Windows"
adplus -crash -pn iexplore.exe
(Obviously, change iexplore.exe to whatever browser you are running against.)
Now, use your flex application in the browser until it crashes. This will create a crash dump in %programfiles%\Debugging Tools for Windows\Crash_Mode__Date_02-18-2009__Time_14-40-0202 (actual date will be used).
You can now send that mini-dump (smallest dmp file) to Adobe so they can analyze it properly.
If you want to view the (native) call stacks in hope of discovering what caused the issue, you can load windbg and load the dump file (File > Open Crash Dump). Once it's loaded type the following at the windbg commandline and hit enter:
~* kb 2000
Some specifics on the bug I uncovered regarding masks and textfields:
http://summitprojectsflashblog.wordpress.com/2008/04/16/flash-browser-crashing-bug/
http://team.bkwld.com/2007/11/21/flash-player-crashes-browser-when-closing-window-possible-fix/

Resources