Assign a struct element to other cmm local variable - trace32

I'am using cmm scripts and i want to assign a struct element to other cmm mocal variable like that
&Intermidiate = Debug_Log[0].Name
But i had always the Error as it is shown in the pictureError
structure element assignes to local cmm variable

Debug_Log[0].Name is a HLL expression. Those expressions are only valid for TRACE32 commands starting with Var..
To use the value of a HLL expression with any other command, wrap it in the function VAR.VALUE(<hllexpr>). E.g. like this:
&Intermidiate=Var.VALUE(Debug_Log[0].Name)

Related

How to pass source value to pre processing one at a time/iterate within the same taskflow?

I’ve tried to assign source row value to InOut parameter/ Mapping variable using SetVariable($$p_file_name, FileName).
But It does not update the value once set. I tried solutions from web :
- SetVariable($$p_file_name, Null) ,
- Taskflow variable with assignment to the mapp variable,
- splitting the mapping into 2 parts ( 1st gets the value in Mapp Var & 2nd tries to use it in pre processing cmd) ,
—UserParameter file permanent sets the value &
- Default value with a empty string.
Nothing worked consistently to update the Inout Parameter/Mapping Variable every time a row is read with a new value from source table.
Note : I’ve the run xcopy manually & it works from cmd prompt using the $$p_file_name as source.
My recommendation is to script with variables the manual xcopy you preformed. Admittedly there are many other solutions though maintaining your own script and variables will give you a consistent result.

how can I view a variable name from a given address from t32 cmm script?

how can I view a variable name from a given address from t32 cmm script ?
I have address and want to log the name of the variable from T32 loaded dump or elf ?
You can get the variable name by the address with PRACTICE function sYmbol.Name(<addr>).
E.g.: If variable "myvar" is at address D:0x100 you can get the name again from the address with
PRINT sYmbol.Name(D:0x100)
or assign it to a macro like this
&name=sYmbol.Name(D:0x100)

How to pass the repeat count to x command in GDB

The x command can examine memory in GDB. Like
x/4xg 0x60400
Now I am going to define my own x comand which examines memory with specified repeat count, like:
define myXCommand
set var &repeatCount=$arg0
x/(???)xg 0x60400
end
I have tried many ways to pass the variant repeatCount to x command, but I failed finally. My problem is how to pass the repeat count to x command? Appreciated very much if anyone can help.
A convenience variable can be used in most expressions, but the x command only allows the repeat count to be a string of digits, not an arbitrary expression.
What you can do is use the eval command, which does a printf on its arguments and then runs the result as a command.
define myXCommand
set var $repeatCount=$arg0
eval "x/%dxg 0x60400", $repeatCount
end

How to check current breakpoint function in TRACE32?

I'm trying to check if the program stopped in a function in a TRACE32.
I know I can see the the functions in FRAME window but no idea how to copy them to a variable inside my script.
Any idea how to do that ?
You get the name of the function, where the program counter points to with:
PRINT sYmbol.FUNCTION(PP())
(Instead of printing the result you can also assign it to a macro.)
So one approach to check if you've stopped in function myFunc() would be:
PRINT STRing.ComPare(sYmbol.FUNCTION(PP()),"*\myFunc")
Another way is to check if the program counter is inside the first and last address of your function myFunc():
PRINT (ADDRESS.OFFSET(sYmbol.BEGIN(`myFunc`))<=Register(PP))&&(Register(PP)<=ADDRESS.OFFSET(sYmbol.END(`myFunc`)))

AfxGetAppName() returns garbage characters

I have the following line of code in my application:
CString strAppName = AfxGetAppName();
Sometimes it fills strAppName up with garbage characters, and I can't figure out why.
Anyone have any ideas?
TIA.
That is possible if you change m_pszAppName manually.
At the very beginning of application initialization, AfxWinInit calls CWinApp::SetCurrentHandles, which caches the current value of the m_pszAppName pointer as follows:
pModuleState->m_lpszCurrentAppName = m_pszAppName;
That is, the module state struct holds a copy of the m_pszAppName pointer. If you change m_pszAppName in InitInstance as adviced in MSDN, you still have the old pointer value in pModuleState->m_lpszCurrentAppName. The AfxGetAppName() function returns AfxGetModuleState()->m_lpszCurrentAppName.
You could add data breakpoint on m_lpszCurrentAppName and on m_pszAppName. It is initialized in <...>\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\appinit.cpp file. You'll see what is going on with that variable and who's trying to change it.