Skip to main content
Associate II
May 2, 2024
Solved

Is it possible to load an array data while debugging?

Hello,

I would like to know if is it possible to load an array data (from a text file or something like that) while debugging.

Imagine to have the array 

int data[100];

I would like to be able to fill it (while debugging) with values generated by me.

Is there a way to do that?

 

Thanks in advance

 

 

This topic has been closed for replies.
Uwe Bonnes
Uwe BonnesBest answer
Chief
May 2, 2024

With Python and probably Excel, you should be able to generate such a script.

5 replies

mƎALLEm
ST Technical Moderator
May 2, 2024

Hello,

What do you mean by "from a text file or something like that"?

int data[100] will consumes 400 bytes (4*100). So you need to take care about the RAM size of your device.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
NexumAuthor
Associate II
May 2, 2024

I mean that I would like to load in my array data created by excel to simulate the acquisition.

Anyway, I have enough RAM to create some constant array already filled with my data and use them

Thanks for your help

Uwe Bonnes
Uwe BonnesBest answer
Chief
May 2, 2024

With Python and probably Excel, you should be able to generate such a script.

Uwe Bonnes
Chief
May 2, 2024

In the debugger, commands like "p data[0] = 0x1234567" will write to the array. Gdb can work with scripts, so create a script with the values you want and run that script.

NexumAuthor
Associate II
May 2, 2024

I'll try them thanks