Bug 581034 - "long long int" data type can't be recognized from dwarf5 debug info generated by llvm15
Summary: "long long int" data type can't be recognized from dwarf5 debug info generate...
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-11 02:37 EST by Gang Xu CLA
Modified: 2022-11-14 00:38 EST (History)
1 user (show)

See Also:


Attachments
sleep.out was build with llvm15 on linux (477 bytes, text/x-csrc)
2022-11-11 02:41 EST, Gang Xu CLA
no flags Details
dwarf dump for sleep.out (4.45 KB, text/plain)
2022-11-11 02:50 EST, Gang Xu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gang Xu CLA 2022-11-11 02:37:31 EST
when putting expression (long long int)0x5566 on expression view. 
it got an error message "At col 6: Illegal usage of a type in expression. Invalid expression".

From the tcf log:
TCF Command: 
Expressions create "P184467437" null "(long long int)23"
Replay:
"At col 6: Illegal usage of a type in expression. Invalid expression"


Some change has made in LLVM15:
https://github.com/llvm/llvm-project/issues/58838
DW_AT_name is not same for "long long int" type from clang-14

"long long int" type in source file is translated to DW_AT_name "long long" in LLVM15.


//////////////////////
Seems the code need to change:

https://git.eclipse.org/r/tcf/org.eclipse.tcf.agent.git ( commitment  5e0265c2 -(2022-11-04 11:46:21 +0000))  
In gent/tcf/services/symbols_elf.c
1686                         if (strcmp(name, base_types_aliases[i].name) == 0) {              
1687                             find_in_dwarf(base_types_aliases[i].alias); 
change to:
1686                         if (strcmp(name, base_types_aliases[i].alias) == 0) {              
1687                             find_in_dwarf(base_types_aliases[i].name); 


"base_types_aliases[i].name" is what need to find in dwarf instead of "base_types_aliases[i].alias"
Is that right?

///////////////////////////

relevant code:
agent/tcf/services/symbols_elf.c

1616 int find_symbol_by_name(Context * ctx, int frame, ContextAddress ip, const char * name, Symbol ** res) {

.....
1685                     while (base_types_aliases[i].name) {                                  
1686                         if (strcmp(name, base_types_aliases[i].name) == 0) {              
1687                             find_in_dwarf(base_types_aliases[i].alias);                   
1688                             if (find_symbol_list != NULL) break;                          
1689                         }                                                                 
1690                         i++;  
......
}

 144 } base_types_aliases[] = {                                                                
 145     { "int", "signed int" },                                                              
 146     { "signed", "int" },                                                                  
 147     { "signed int", "int" },                                                              
 148     { "unsigned", "unsigned int" },                                                       
 149     { "short", "short int" },                                                             
 150     { "signed short", "short int" },                                                      
 151     { "signed short int", "short int" },                                                  
 152     { "unsigned short", "unsigned short int" },                                           
 153     { "long", "long int" },                                                               
 154     { "signed long", "long int" },                                                        
 155     { "signed long int", "long int" },                                                    
 156     { "unsigned long", "unsigned long int" },                                             
 157     { "unsigned long", "long unsigned int" },                                             
 158     { "long long", "long long int" },                                                     
 159     { "signed long long", "long long int" },                                              
 160     { "signed long long int", "long long int" },                                          
 161     { "unsigned long long", "unsigned long long int" },                                   
 162     { "unsigned long long", "long long unsigned int" },                                   
 163     { NULL, NULL }                                                                        
 164 };
Comment 1 Gang Xu CLA 2022-11-11 02:41:32 EST
Created attachment 288832 [details]
sleep.out was build with llvm15 on linux
Comment 2 Gang Xu CLA 2022-11-11 02:50:42 EST
Created attachment 288833 [details]
dwarf dump for sleep.out
Comment 3 Gang Xu CLA 2022-11-11 02:51:16 EST
Seems the code need to change:

https://git.eclipse.org/r/tcf/org.eclipse.tcf.agent.git ( commitment  5e0265c2 -(2022-11-04 11:46:21 +0000))  
In gent/tcf/services/symbols_elf.c
1686                         if (strcmp(name, base_types_aliases[i].name) == 0) {              
1687                             find_in_dwarf(base_types_aliases[i].alias); 
change to:
1686                         if (strcmp(name, base_types_aliases[i].alias) == 0) {              
1687                             find_in_dwarf(base_types_aliases[i].name); 


"base_types_aliases[i].name" is what need to find in dwarf instead of "base_types_aliases[
Comment 4 Eugene Tarassov CLA 2022-11-14 00:38:45 EST
Fixed.
Thanks!