What are the allowed characters for Android logcat? - logcat

I looked at the document, but could not find the information about the legitimate character set. Could anyone shed some light on this?
The following code:
Log.d("debug", "123456-Test1Line1-123456\r\n123456-Test1Line2-123456");
generates the the following occasionally:
123456-Test1Line2-123456
The following code:
Log.d("debug", "123456-Test2Line1-123456\n123456-Test2Line2-123456");
generates the following consistently:
06-28 01:33:21.839 11497-15151/net.mydomain.myapp D/debug: 123456-Test2Line1-123456
123456-Test2Line2-123456
The following code:
Log.d("debug", "123456-Test3Line1-123456\r123456-Test3Line2-123456");
outputs nothing.
It looks like that "\r" should be avoided.
I am fairly sure that "\r" used to be OK. I have been using it extensively (outputting contents written to a files to logcat for debugging).

Related

Colored output to screen in C

I've wrote this very basic code-lines with colored output:
printf("\033[1;32m"); // boldgreen code: \033[1;32m according to:
http://web.theurbanpenguin.com/adding-color-to-your-output-from-c/
puts("Enter username:");
gets(user);
In my computer evreything works fine and I get colored output as expected:
but in other computers I get this Output:
\033[1;32mEnter username:
I have to say that all my #includes are fine, Im just doing copy-paste to another computer & if thats important Im using Visual Studio in both Computers.
seems like basic thing but I don't understand why thats happend.
Thanks for helpers.
Most terminals support colors. The problem is sending the right escape code. For the Windows command line, you have do a different escape sequence. There is a wikipedia entry that describes how to do an escape in different environments.

using GDB with arguments

For a class assignment we needed to write a compiler. This includes an optimizer portion. In other words, we take in a file with some "code". An output file is generated. In the second step we take in the outputted code and remove any "dead" code and re-output to a second file. I have some problems with the optimizer portion and would like to use gdb. But I can't get gdb to operate properly with the input and output files arguments. The way we would normally run the optimizer is:
./optimize <tinyL.out> optimized.out
where tinyL.out is the file outputted in the first step and optimized.out is the file I want to output with the new optimized and compiled code.
I have searched Google for the solution and the tips I have found do not seem to work for my situation. Most people seem to want to only accept an input file and not output a separate file as I need to do.
Any help is appreciated (of course)
I'm not exactly sure what you're asking. But since I'm not yet able to comment everywhere, I write this answer with a guess and edit/delete if necessary.
When GDB is started and before you start the program you wish to debug, set the arguments you want to use with set args.
A reference to the documentation.
You just need to do the file redirection within gdb.
gdb ./optimize
(gdb) run < tinyL.out > optimized.out
https://stackoverflow.com/a/2388594/5657035

PRO*C compile wrong comments

I've a strange behaviour on my pc when a I precompile a .pc source file. I use a command line instruction, like "proc wpd_ric_pla_02.pc wpd_ric_pla_02.c CODE=ANSI_C".
If I compile the very same source file on another machine, with the exact same version of proc (11.1.0.7.0), instead, I have no issue.
I attach an image showing some differences in the .c generated.
You can see on the left the correct .c and, on the right, the .c generated on my machine. SQL instructions are wrongly commented out.
Could someone please help me understand why this happens?
Thank you, Sebastian.
It may have something to do with the file being copied from one machine to the other. But this is only a wild guess.
Maybe the wrong file have some non-visible characters that are messing the compiler.
You can check it by doing a hexdump -c wpd_ric_pla_02.pc if you are in Linux.
If you are using Windows I suggest you use Notepad++ View / Show Symbol / Show All Characters function.
If that doesn't work, try isolting the problem in a single query.

Eclipse CDT: Mapping console output to source file and line

While debugging code it helps to have source filename and line number on console output. I already use FILE and LINE macros. But it would be great if double clicking a line in the console output would take me to the exact source line which was responsible for outputting that line of log. Can eclipse parse console output and do something like this? It need not work all the time, only when the log line is in a specific format and the source filename and line number are valid.
It's possible to use a workaround if you add the pydev plugin and a few lines of python to call your main function. You can find the needed code here: https://github.com/oct15demo/python_calls_cpp
As noted there, I posted a query on the Eclipse forum to find out the status of any ongoing effort or obstacles to implement within Eclipse.
I could not find out any further information on the feature, if it's there, it's well hidden.
Update March 17, 2022, I shall be working on the feature for Eclipse, don't have an estimate of time yet.

emacs flycheck errors and display issues

I'm trying to get used to Emacs, I'm coding in C for my school. So, I installed flycheck to check for potential compliation errors. However, I encounter several problems. Here's the message I get when I test flycheck with the c/c++-gcc checker : flycheck buffer
I have two issues there : - first, flycheck claims the checker "returned a 1 exit code without errors" depsite the fact it actually did, and it's even displaying it right after ! - secondly, it does not seem to be able to display quotes correctly, the only thing displayed are their unicode escape sequences.
I can't find out why those issues are present. Can anybody help me on this ?
fixed both my problems by setting my environment language to UTF-8.

Resources