Knowledge Library
Coming this winter – A new and improved Wind River Support site, redesigned from the ground up
Knowledge Library Home Knowledge Library Products Development Tools LLVM Compiler TCLLVM-155 : Debugger gets incorrect RTP TLS variable value on ARM64/LLVM

TCLLVM-155 : Debugger gets incorrect RTP TLS variable value on ARM64/LLVM

Defect #: TCLLVM-155
Previous IDWB4-7928
Found In VersionLLVM 6.0.0.2
Severity:Standard
Status:Not to be Fixed
Created Date:10/11/2018
Component/s :Compiler
Host OS:Linux Ubuntu
Architecture:ARM

Description

When debugging the RTP, the variable "tls_rtp_var" is not considered to be a TLS variable because of the wrong DWARF info.

Steps to Reproduce

1. Create and build a VSB for xlnx_zynqmp with smp, 64bit and debug on and using llvm;
2. Create a VIP based on above VSB and add with development profile;
3. Add component INCLUDE_DEBUG_AGENT_START in the VIP configuration;
4. Create and build RTP with the attached source file "test.c";
5. Boot up target with above VIP image;
6. Connect target in application mode;
7. Right click on the RTP project and select Run/Debug Real Time Process from the context menu;
8. Select Attach Debugger and Break At Main and click OK;
9. Add breakpoint at line #57 normal_static++; 
10. Resume;
11. Check the TLS variable values from debugger GUI and Terminal console output printf message.

/* test.c */
#include <vxWorks.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ioLib.h>
#include <dlfcn.h>
#include <taskLib.h>

static int normal_static = 4;
__thread int tls_rtp_var = 6;

void * rtp_dump_tls_variables(void * arg) {
    int myValue = (int)(uintptr_t) arg;
    tls_rtp_var = myValue;
    printf("Starting thread %d\n", tls_rtp_var);
    while(1) {
        normal_static++;      /* breakpoint on this line usin pattern */
        taskDelay(20);
    }
}
int main(int argc, char **argv) {
    printf("TLS Sanity RTP test started\n"); 
    taskSpawn ("tls_rtp_t1", 250, 0, (size_t) 5000, (FUNCPTR) rtp_dump_tls_variables, 1L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L);
    taskSpawn ("tls_rtp_t2", 250, 0, (size_t) 5000, (FUNCPTR) rtp_dump_tls_variables, 2L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L);
    while(1) {
        taskDelay(20);
    }
}

Related defect

TCLLVM-72  ARM64: &amp;quot;R_AARCH64_ABS64 used with TLS symbol&amp;quot; warning while building a VIP with debugging enabled

KLID_DEFECT (use as Content ID for linking):  KLID_DEFECT_57844
 
Last modified