Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] Find Symbol by Name, Address, Scope

Hi!

I've managed to see 'somethin' in the variables view in Eclipse. Unfortunately it's just a fake name ..

I observed that e.g. find_pe_symbol_by_name() always gets called but the name is always the function that the program stopped. 

I'm still not quite sure how everything in symbols_x.c is supposed to work.

Why do I only get the function name? Is this supposed to be like that? If so.. how and when does the agent ask for all symbols of that function? I slowly start to understand but there is a lot going on which is still confusing me a little ..

Thank you for any further help here :)

Best regards,
Stefan

--
Stefan Falk

Infineon Technologies Austria AG
Trainee
Automotive Sense and Control
Component Verification

Tel:  +43 (0)5 / 1777 - 5439
Email: stefan.falk@xxxxxxxxxxxx

"Aim above the mark to hit the mark." - Ralph Waldo Emerson

-----Original Message-----
From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Christophe Augier
Sent: Wednesday, June 18, 2014 1:51 PM
To: tcf-dev@xxxxxxxxxxx
Subject: Re: [tcf-dev] Find Symbol by Name, Address, Scope

Hi Stefan,

look at identifier() in expressions.c. It calls find_symbol_by_scope() 
and find_symbol_by_name(). You probably need to implement both of them 
to start getting results.

- Christophe

On 06/18/2014 01:46 PM, Stefan.Falk@xxxxxxxxxxxx wrote:
> Hi Xavier and thanks for your answer. It helped a lot!
>
> Unfortunately I'm still a little stuck .. I never see that request in the TCF trace. It seems that first there is an "Expression create" command which (I think) then calls somehow findByName.
>
> So basically I think I understand what I need to do. If an expression should be evaluated it is first created and somehow assigned an ID. This ID is my part of the job if I got this right.
>
> But I have some troubles finding the place where I have to start and I am still not sure what the agent needs and how it handles expressions/symbols internally.
>
> It's just that I am a little confused what the first line code is I have to get hands on here since I don't get how the "Expression" service and "Symbol" service are working together here ..
>
> I feel like I know what needs to be done and simultaneously having no idea where to start with at the moment. :D
>
> Best regards,
> Stefan
>
> --
> Stefan Falk
>
> Infineon Technologies Austria AG
> Trainee
> Automotive Sense and Control
> Component Verification
>
> Tel:  +43 (0)5 / 1777 - 5439
> Email: stefan.falk@xxxxxxxxxxxx
>
> "Aim above the mark to hit the mark." - Ralph Waldo Emerson
>
> -----Original Message-----
> From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Xavier Pouyollon
> Sent: Friday, June 13, 2014 4:20 PM
> To: TCF Development
> Subject: Re: [tcf-dev] Find Symbol by Name, Address, Scope
>
> Hi Stefan,
>
> You're on the right track by using the symbols_win32.c file as a
> starting point.
> Look at all public (non static function).
> Then replace the code in these function to parse the CDB file.
>
>   From the frame and ip (where your program is stopped for the frame
> level), you should be able to retrieve the right entry in your CDB file
> and return the proper information.
> (see later)
>
> Don't hesitate to create a Symbol structure to fit your needs.
> See how the definition differs from symbols_elf.c and symbols_win32.c.
> Adapt this to your needs.
>
> If you look at TCF request, when you ask a for a symbol using tcf
> Symbols findByName, it will usually return a pretty long id with many
> separators (.) in it.
> Then a tcf Symbols getContext on this id will return you the answer.
> The id is "decyphered" in the getContext and the id contains information
> like which entry and type in your debug information (CDB in your case).
>
> In other words:
> tcf Symbols findByName
> ==> returns an id whose fields are pointer / type information / whatever
> you want referencing your CDB file
>
> tcf Symbols getContext id
> ==> Parse the id and returns the information from the CDB file.
>
> Hope it helps,
> Good luck !
> Xavier.
>
> On 06/13/2014 03:46 PM, Stefan.Falk@xxxxxxxxxxxx wrote:
>> Hi Xavier, hi Christophe and thanks for answering!
>>
>> I am using the SDCC (http://sdcc.sourceforge.net/) to compile for the i8051. It produces a CDB file (http://sdcc.sourceforge.net/mediawiki/index.php/CDB_File_Format) which I already parsed and extracted all debug information so far.
>>
>> I am integrating a full CDB parser interface and an interface to a proprietary debugger for the agent.
>>
>> Right now I am not able to retrieve information about the stack frame. At the moment is all that could potentially work is getting values from variables which are either stored inside RAM or registers. So stack is not supported yet.
>>
>> Hope that makes sense to you. If you need more information about what I am doing feel free to ask!
>>
>> Thank you!
>>
>> --
>> Stefan Falk
>>
>> Infineon Technologies Austria AG
>> Trainee
>> Automotive Sense and Control
>> Component Verification
>>
>> Tel:  +43 (0)5 / 1777 - 5439
>> Email: stefan.falk@xxxxxxxxxxxx
>>
>> "Aim above the mark to hit the mark." - Ralph Waldo Emerson
>>
>> -----Original Message-----
>> From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Xavier Pouyollon
>> Sent: Friday, June 13, 2014 3:11 PM
>> To: TCF Development
>> Subject: Re: [tcf-dev] Find Symbol by Name, Address, Scope
>>
>> Hi Stefan,
>>
>> What compiler are you using for your 8051 ?
>> Does this compiler generates dwarf debug informations ?
>> To know that, try objdump -h or readelf on the generated file.
>>
>> If you can have a compiler for your 8051 that generates Dwarf
>> information, nearly all the job is done because TCF handles Dwarf debug
>> information format.
>>
>>    > I don't really understand either how a name should be enough since
>> there could be thousands of "int i;" declarations spread over a program.
>> With no further information (like scope or PC location) this task seems
>> impossible to me.
>>
>> Download a Dwarf specification : http://www.dwarfstd.org/doc/Dwarf3.pdf
>> You'll see the debug_infos is a kind of tree defining variables,
>> function, scopes and will provide rules on how to compute a variable
>> location, variable type.
>>
>> If your compiler does not generate dwarf information, it should generate
>> similar datas.
>> Either you adapt the TCF code for these proprietatry datas or you write
>> a converter that will generate Dwarf informations.
>>
>> Hope it helps,
>> Best Regards,
>> Xavier.
>>
>> On 06/13/2014 02:24 PM, Stefan.Falk@xxxxxxxxxxxx wrote:
>>> Hi folks!
>>>
>>> Since setting breakpoints and displaying register contents are already working, the next step would be to load and display the values of symbols/variables.
>>>
>>> I see - from symbols_win32.c - that there are several functions that are dedicated to that task. I was now wondering what the best way would be to implement that for my i8051.
>>>
>>> What I already have is a complete information structure of my program containing details like
>>>
>>> -       Modules, holding
>>> o       Global variables
>>> o       Functions
>>> -       Functions, holding
>>> o       Start, end address
>>> o       Local variables
>>> -       Variables, holding
>>> o       Location address (RAM, Register)
>>> o       Scope information (in C code)
>>> -       Memory Areas, holding
>>> o       Modules (for faster program counter mapping)
>>>
>>> So all that is missing is to integrate that into the agent.
>>>
>>> What would the best way to do that? As I have e.g. the exact scope information of a variable it would be fastest and easiest if Eclipse would sent me file:line:scope. I debugged it and what I saw was that either find_by_name or find_by_address was called.
>>>
>>> Is find_by_address only called if find_by_name didn't succeed?
>>> I don't really understand either how a name should be enough since there could be thousands of "int i;" declarations spread over a program. With no further information (like scope or PC location) this task seems impossible to me.
>>>
>>> So is there a way to get more information from Eclipse like the scope of the symbol?
>>>
>>> Thanks and best regards!
>>>
>>> --
>>> Stefan Falk
>>>
>>> Infineon Technologies Austria AG
>>> Trainee
>>> Automotive Sense and Control
>>> Component Verification
>>>
>>> Tel:  +43 (0)5 / 1777 - 5439
>>> Email: stefan.falk@xxxxxxxxxxxx<mailto:stefan.falk@xxxxxxxxxxxx>
>>>
>>> "Aim above the mark to hit the mark." - Ralph Waldo Emerson
>>>
>>>
>>>
>>> _______________________________________________
>>> tcf-dev mailing list
>>> tcf-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/tcf-dev
>> _______________________________________________
>> tcf-dev mailing list
>> tcf-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/tcf-dev
>> _______________________________________________
>> tcf-dev mailing list
>> tcf-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/tcf-dev
> _______________________________________________
> tcf-dev mailing list
> tcf-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tcf-dev
> _______________________________________________
> tcf-dev mailing list
> tcf-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tcf-dev

_______________________________________________
tcf-dev mailing list
tcf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tcf-dev


Back to the top