When using GDB in C++ with Eigen, how can I see more of a big matrix? - c++

I am able to see so much of a matrix, but then it just says "..." and stops. Is there a way to get the rest?

Is there a way to get the rest?
Try (gdb) help set print elements and set print elements unlimited.

Related

Debugging in VSCODE: Watching vectors with length > 1000

I am using vscode on Ubuntu and debugging with GDB using the C/C++ extension. I am trying to view the contents of an STL vector in the watch view but I can only see the first 1000 elements. I know this has been discussed here but is there a workaround or temp fix for this?
Thanks
I can see several possibilities:
Change the maximum number of displayed lines in the preferences (if the option exists).
Split the vector in several sub-vectors with a maximum size of 1000 elements.
Write the vector contents into a file.

How to parse a matrix in Python?

I created a matrix of 0s using join(). Assignment works if I hotcode it. If I get as an input, it doesn't work.
theatre=[]
for i in range(5):
theatre.append(["0"]*5)
def print_screen(theatre):
for i in theatre:
print(" ".join(i))
print_screen(theatre)
theatre[int(raw_input("Enter row"))][int(raw_input("Enter col"))]=="x" ## this doesn't work
theatre[0][1]="x" ## This is working.
Oh Boy surely the problem you stated would exist in your code as it is NOT AT ALL A PROBLEM as far as python interpreter is considered.
See what you are doing
theatre[int(raw_input("Enter row"))][int(raw_input("Enter col"))]=="x" ## this doesn't work
is to compare if the value at a given point in the matrix is equal to x or not, so as far as your code goes python is comparing the given point and then just moving on to the next statement.
I would suggest that instead of asking here, it would be more helpful for you if you try to debug your code using print() statement or any debugger.

ABORT function not working in expression transformation informatica

I have a scenario where in need to compare the amount and if they don't match ABORT the session.
I have done the below logic, but some how the ABORT function is not working.(Error says has an error evaluating variable column)
this is what i did:
i have 3 source columns DLY_NET_AMT_DUE, WKLY_INVCD_AMT, INV_CHARGE_AMOUNT. All are inputs. I used a variable port and said
v_INV_CHARGE_AMOUNT=iif((DLY_NET_AMT_DUE=WKLY_INVCD_AMT) and
(WKLY_INVCD_AMT=INV_CHARGE_AMOUNT),'Amount Balanced',ABORT('Amount Not Balanced'))
o_INV_CHARGE_AMOUNT=v_INV_CHARGE_AMOUNT
Could you guys please help me where am i going wrong.
Please paste the exact error message.
If possible, share the transformation screenshot
What is the datatype of v_INV_CHARGE_AMOUNT port? Is it possible that it's decimal and the error is caused by trying to put Amount Balanced as value?
Did you try to run debugger and do the Evaluate expression?

How to print content of a list of pointers in gdb?

I have the following list of pointers:
(here is a simple example, but in reality, my list could be componed by hundreds of entries)
{0xae5c4e8, 0xa09d4e8, 0xa753458, 0xae554e8}
I successfully print pointers content, one by one, by using :
p *(const Point *) 0xae5c4e8
How can I print contents of the preceding list in one command ?
There is no canned way to do this. It would be cool if you could type print *(*p # 23) -- using the # extension inside another expression, resulting in an implicit loop -- but you can't.
However, there are two decent ways to do this.
One way to do it is to use Python. Something like:
(gdb) python x = gdb.parse_and_eval('my_array')
(gdb) python
> for i in range(nnn):
> print x[i].dereference()
> end
You can wrap this in a new gdb command, written in Python, pretty easily.
Another way is to use define to make your own command using the gdb command language. This is a bit uglier, and has some (minor) limitations compared to the Python approach, but it is still doable.
Finally, once upon a time there was a gdb extension called "duel" that provided this feature. Unfortunately it was never merged in.
I don't think there is a simple way to show all the list elements at once. You could try to iterate through the items using:
set $it=mylist.begin()._M_node
print *(*(std::_List_node<const Point *>*)$it)._M_data
set $it=(*$it)._M_next
...
In the batch way. The problem is that the list items do not need to be located near to each other in the memory. To have better preview option in debug you could switch to the std::vector.
Hope this will help.
I have the following list of pointers:
You don't appear to have a list, you appear to have an array. Let's assume that it looks something like:
void *array[10] = {0xae5c4e8, 0xa09d4e8, 0xa753458, 0xae554e8};
You can print the first 4 dereferenced elements of that array like so:
(gdb) print ((Point**)array)[0]#4

How the expression transformation works?

Suppose, I am getting id, marks as input to expression transformation. I am calculating values like this.
ID--------------------------------------Input/Output Port
MARKS-----------------------------------Input Port
O_RESULT= V_RESULT----------------------Output Port
V_RESULT=IIF(MARKS > 60,"PASS","FAIL")--Variable Port
When i debug this code, Normally it calculates the values in the sequencial order. In above example, i have assigned V_RESULT to O_RESULT before calculating it. Still it is showing right result. Ideally, It should show NULL value.
Can somebody tell me why is it showing correct result?
Is there any setting in informatica for reference values? Does it store any unknown value reference for it and later replace it?
Would be grateful for help.
Output ports are evaluated after variable ports. I think this is the reason.
because output port is calculated last. Had o_result been variable port,then it should have shown the result you expected.
Because in debug mode, you see the last snapshot of each row. Debugger does not show separate rows for calculation and assignment. like in you case one row where o_result=null and v_result= and other row for o_result= and v_result=. But rather debugger will show last snapshot of each row. i.e. whatever o_result and v_result both have values.
but if you run the workflow, o_result will not be having any values.