LLDB prints `i8` as "signed char" - visual-studio-code

I'm using the LLDB extension for VSCode, and my variables typed as i8 are printed as characters. Both in the VSCode debugging panel, and when using print in the debugger console.
The variable is defined in the following way:
for y in 0..self.height
self.height being an i8.
I found How do I make the Xcode debugger show uint8_t values as numbers?, but even trying to add a fromat: type format add -f decimal int8_t, print y still outputs (signed char) $5 = '\a' instead of (let me consult the C escape sequences and the ascii chart...) 7.

If anybody else runs into this, this might be of use:
frame variable --format d y
The variable will be printed as "decimal" indicated by the d. A list of all formats can (AFAIK) be found here: https://lldb.llvm.org/use/variable.html#id1.
After further trail and error, I figured out how to format all "signed char" in decimals, at least for the current session:
type format add --format d 'signed char'
This will work both when printing the variable in the debug console, and it will also update the values in the debug panel of VSCode immediately.
If anybody knows how to get this persistent, or even better, tell LLDB that the type is in fact not a char but an integer, please let me know.

I know the thread is a few months old, but i encountered the same issue. I managed to fix it by going to the extension settings for CodeLLDB through the UI, and adding the command under Pre Run Commands. For some reason it doesn't work through the launch.json for me either.
For my use case I just added:
type format add --format u 'unsigned char'

Related

VSCode Clangd extension wrong function argument type annotation

For some reason, Clang is showing five x type annotations (lines 24 & 25) and I don't know why, shouldn't be just one?
It is not so bad in this example, but it gets annoying with larger expressions.
I want to know why is this happening

How to "alias" g++ or other commands with non-alphanumeric characters?

set -x "g++" "/usr/local/gcc-7.1/bin/g++-7.1"
will not work due to non-alphanumeric "++" characters. (Error message: "set: Invalid character “+” in variable name.")
Am I out of luck here or is there a work around? I just switched to fish less than 24 hours ago and not sure if there is a work around for aliasing g++.
Thanks for your time.
The simplest:
alias g++ /usr/local/gcc-7.1/bin/g++-7.1
set doesn't create an alias, it sets a variable.
So set -x g++ something is trying to set a variable called "g++" to the value "something" and export it (the "-x").
Now, you most likely want to do what ridiculous_fish suggested and define an actual alias (or a function - which alias desugars to, or an abbreviation) with alias or function or abbr.
Also, the "+" character isn't allowed in variable names. That's because, while fish could allow it, other shells don't. And since variables can be exported, their names need to be compatible with those (try g++=something in bash - it'll try to run it as a command). See Allowed characters in linux environment variable names for further information.

how I can define variable name with " write " command in fortran

I need to define a variable name for different files inside a Fortran code, while I 'm using this commands
open(unit=5,file="plot.sm")
write(unit=zbin_str,fmt='(f5.2)') zbin
plotname="LF_z"//zbin_str//".ps"
write(5,"dev postencap" plotname)
write(5,"toplabel LF for",//zbin_str//)
I'm receiving these errors :
Syntax error, found '//' when expecting one of: ( * <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> ...
write(5,"toplabel LF for",//zbin_str//)
error #6355: This binary operation is invalid for this data type. [PLOTNAME]
write(5,"dev postencap" plotname)
An arithmetic or LOGICAL type is required in this context.
write(5,"dev postencap" plotname)
How I can define the available name inside the Fortran code??
Thanks
Neither of these lines
write(5,"dev postencap" plotname)
write(5,"toplabel LF for",//zbin_str//)
is well-formed; that's what the compiler is trying to tell you.
Beyond that, I'm not sure what you are trying to do or, therefore, how to fix it. Unless you use keywords your Fortran compiler will understand the 2nd argument in a write statement to be the format specifier in which you want to present the output. I can't see how either "dev postencap" plotname or "toplabel LF for",//zbin_str// can be made into a valid format specifier. Perhaps what you want is
write(5,'(a32)') "dev postencap"//plotname
write(5,'(a32)') "toplabel LF for"//zbin_str
Anything more would be based on guesswork. If this doesn't answer your question explain it more clearly if you can.

Weird gdb behaviour on Xcode 4.2 after moving to LLVM 3.0 and libc++

After swaping compiler to LLVM 3.0 and libc++ to have C++11 suport (unique_ptr is a little jewel :)) I have noticed gdb is not working properly when I try to print an object information. What I have tested is the following:
1) I have a std::vector < std::unique_ptr > member variable. If I set a breakpoint inside the class containing this member var and do a "print _reusableEntities.size()" I get this:
Breakpoint 2, GameObjectMgr::createGameObject (this=0x0) at /Users/hexdump/Dropbox/Games prototypes/Re-World/src/ReWorld/Engine/EntityManagement/GameObjectMgr.mm:92
92 go=std::move(_reusableEntities.back());
The program being debugged stopped while in a function called from GDB.
When the function (GameObjectMgr::createGameObject()) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).
But if I have a line of code like:
int size=_reusableEntities.size()
it reads the size ok. It really seems a gdb problem when inspecting the vector size. In the other hand I can see how the vector contains correct values in the Local vars windows.
Another thing that is really weird is why the error shows information related to createGameObject function because It has nothing to do with the gdb command call and I wasn't inside it when trying to print the values.
It is really weird and a pain in the ass when debugging.
2) I have F7 configured to step over functions. This worked until I made this changes, now, it doesn't matter if I push F6 (step into) or F7 (step over) I'm always getting inside unique_ptr code when copying, or getting raw pointer from it :/.
If anyone could guess what is happening I would be really grateful, anyway, I know it is really difficult to guess from just my explanation. If anyone needs more info, please, ask for it.

Eclipse code completion problem

why doesn't eclipse match the argument while doing code completion. In the following example it should have automatically matched the throwable. In stead it shows arg1 as the first option.
The autocomplete options in Eclipse for auto-completed method arguments, start with the parameter names found in the source distribution (that contains the class with the method). If no source distribution is available, then it will use the parameter names as indicated in the binary distributions i.e. in the compiled byte code. This is the default behavior
If you want to change this behavior of inserting parameter names from source code or binaries to inserting the best guessed arguments (including local variables), then you can configure the auto-complete options of Eclipse to do so, as shown in the following screenshot:
This will produce the desired result of automatically displaying the options containing the list of best-guessed arguments. This also seems to avoid suggesting parameter names:
I guess arg1 is thing you already typed. So the proposal eclipse can provide is trying to find something which start from arg1.
So it puts it as the first choice.
You can type t , and try Alt+/ , to see if this is the reason.