cancel
Showing results for 
Search instead for 
Did you mean: 

A big problem with Live Expression (values shifted down)

Alaa_Alnasef96
Associate

I have a problem with CubeIde (version independent tried on both 1.13 and 1.16)

the problem is that in live expression I am using a struct to combine each task in single struct for debugging purpose
the values of the variables all shifted down 
example:
var1: 0
var2: value of var1
var3: value of var2
char arr[100]: [value of var3
                        value of arr[0]
etc]

I am using threadx, the problem doesnot exist when working on UBUNTU while in windows is happening all time.
the other thread values are correct, it happen only on the second thread.

 

/* Includes ------------------------------------------------------------------*/
#include "app_threadx.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "main.h"
#ifdef ExampleProtocole
#include "ExampleCommunicationTask.h"
#endif
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
#ifndef URMETPROTOCOL
#define MAIN_THREAD_STACK_SIZE					4096
#elif defined(URMETPROTOCOL)
#define MAIN_THREAD_STACK_SIZE					4096
#define Example_COMMUNICATION_THREAD_STACK_SIZE	4096
#endif
/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
uint8_t main_thread_stack[MAIN_THREAD_STACK_SIZE];
TX_THREAD mainThreadPointer;
#if defined(ExamplePROTOCOL)
uint8_t urmet_thread_stack[Example_COMMUNICATION_THREAD_STACK_SIZE];
TX_THREAD exampleCommunicationPointer;
#endif
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
static void MainThreadEntry(uint32_t initialInput);
#if defined(ExamplePROTOCOL)
static void ExampleCommunicationThreadEntry(uint32_t initialInput);
#endif
/* USER CODE END PFP */

/**
 * @brief  Application ThreadX Initialization.
 * @PAram memory_ptr: memory pointer
 * @retval int
 */
UINT App_ThreadX_Init(VOID *memory_ptr) {
	UINT ret = TX_SUCCESS;
	/* USER CODE BEGIN App_ThreadX_MEM_POOL */

#ifdef ExamplePROTOCOL

#endif
	/* USER CODE END App_ThreadX_MEM_POOL */
	/* USER CODE BEGIN App_ThreadX_Init */
	if (tx_thread_create(&mainThreadPointer, (char*)"MainThread",
			MainThreadEntry, 0x1234, main_thread_stack,
			MAIN_THREAD_STACK_SIZE, 15, 15, 1,
			TX_AUTO_START) != TX_SUCCESS) {
		return TX_THREAD_ERROR;
	}
#ifdef ExamplePROTOCOL
	if (tx_thread_create(&exampleCommunicationPointer, (char*)"ExampleCommunicationThread",
			exampleCommunicationThreadEntry, 0x1234, example_thread_stack,
			Example_COMMUNICATION_THREAD_STACK_SIZE, 15, 15, 1,
			TX_AUTO_START) != TX_SUCCESS) {
		return TX_THREAD_ERROR;
	}
#endif
	/* USER CODE END App_ThreadX_Init */

	return ret;
}

/**
 * @brief  MX_ThreadX_Init
 * @PAram  None
 * @retval None
 */
void MX_ThreadX_Init(void) {
	/* USER CODE BEGIN  Before_Kernel_Start */

	/* USER CODE END  Before_Kernel_Start */

	tx_kernel_enter();

	/* USER CODE BEGIN  Kernel_Start_Error */

	/* USER CODE END  Kernel_Start_Error */
}

/* USER CODE BEGIN 1 */
void MainThreadEntry(uint32_t initialInput) {
	MainThreadFunction();
}
#ifdef ExamplePROTOCOL
void ExampleCommunicationThreadEntry(uint32_t initialInput) {
	ExampleThread();
}

 


screenshot of the problem 

 

Alaa_Alnasef96_1-1722428599371.png

where as you can see firstrun should be 1 and firstZDAGps is also 1 so we have everthing is shifted down. 

6 REPLIES 6
Mahmoud Ben Romdhane
ST Employee

Hello @Alaa_Alnasef96 ,

 

Welcome to the ST Community and let me thank you for reporting this issue.

I am escalating an internal ticket to the concerned team (ticket number: 201886)

 

Best Regards.

Mahmoud

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @Alaa_Alnasef96 ,

Further to your comment, I recommend that you set the variable format on Live Expression by clicking on Number Format.

MahmoudBenRomdhane_0-1740040899232.png

Thanks.

Mahmoud

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

KraPet_CZ
Associate

It's been a year and the described shift problem still persists.

I'm working on STM32CubeIDE v1.19.0.

 

I have an array of structures:

typedef struct sdcs_struct
{
  uint8_t slotNumber;
  uint8_t pwrPin;
  uint8_t csPin;
  uint8_t sensorIndex;
  uint8_t maxSenIndex;
  uint16_t bitmapIndex;
  uint16_t aiTx_u16;
  uint16_t aiRx_u16;
  char oenCode[6+1];
} sdcs_t;

sdcs_t snsrGas_a[3];
sdcs_t *pSnsrGas;

 

In the "Expressions" window it is displayed correctly.
But in the "Live Expressions" window the items are shifted by 1 byte.

What's more. Look at the addresses in the "Live Expressions" window for the pSnsrGas pointer. They don't make any sense at all. 

 

Correctly displayed content in "Expressions" window
(order: pSnsrGas, snsrGas_a[0], snsrGas_a[1], snsrGas_a[2])

STM32CubeIDE Expressions - 1 - Array - Element 0.png

STM32CubeIDE Expressions - 2 - Array - Element 1.png

STM32CubeIDE Expressions - 3 - Array - Element 2.png

STM32CubeIDE Expressions - 0 - Pointer.png

    

Incorrectly displayed content in "Live Expressions" window
(order: pSnsrGas, snsrGas_a[0], snsrGas_a[1], snsrGas_a[2])

The items 'aiTx_u16' and 'aiRx_u16' in the pointer even have a completely different value, zero.

STM32CubeIDE Live Expressions - 0 - Pointer.png

STM32CubeIDE Live Expressions - 1 - Array - Element 0.png

STM32CubeIDE Live Expressions - 2 - Array - Element 1.png

STM32CubeIDE Live Expressions - 3 - Array - Element 2.png

    

MM..1
Chief III

Same issue 1.18.0

The Temporary Solution for that problem was already published by @Makk on 2025-03-29 5:16 AM

https://community.st.com/t5/stm32cubeide-mcus/live-expression-values-gets-corrupted-while-debugging-with/m-p/788209/highlight/true#M35347

 

Step 1) Close the Tab of the Live Expressions.

Step 2) Right Click on Project >> Select "Clean Project"

Step 3) Build and debug

Step 4) Select the "Live Expression" from the windows tab

 

As long as you do not edit the code, Live expressions will work fine but if you do edit the code then make sure to follow above procedure.

nico23
Senior II

It's crazy that ST is taking years to fix a live visualization of variables in debug mode...

Thanks for the walkaround @KraPet_CZ