Jump to content

Recommended Posts

Posted

Hi,

 

I am trying to edit some systemc kernel code to improve the performance of simulation. But I need to be able to debug the code by going through the symbols of each file, so I add --enable_debug option while configuring. 

 

When I run the source code with -g option, I find that it is able to go and search the symbols of some files but not all. Like it is able to go inside sc_time.cpp if I use gdb but it is not able to go inside sc_simcontext.cpp where the main execute, update, notify phases occur.

 

Can anyone help me what wold be the best way to go about changing the systemc code and debugging it ?

 

Regards,

Rohit

Posted

Hi,

 

I am trying to edit some systemc kernel code to improve the performance of simulation. But I need to be able to debug the code by going through the symbols of each file, so I add --enable_debug option while configuring. 

 

When I run the source code with -g option, I find that it is able to go and search the symbols of some files but not all. Like it is able to go inside sc_time.cpp if I use gdb but it is not able to go inside sc_simcontext.cpp where the main execute, update, notify phases occur.

 

Can anyone help me what wold be the best way to go about changing the systemc code and debugging it ?

 

Regards,

Rohit

Hello Sir,

I am afraid 'enable-debug' and the GCC '-g' compiler

directive will only allow debugging at the application

level -- not kernel.

In some of the embedded Linux platforms that I use

at work, there is a special 'printk' function. that allows

the programmer to force the kernel to print debug

messages during execution. To use this however, first

of all I identify the location in the source code where

the printk is supposed to be, and then re-compile the

kernel with special options to enable kernel debug

messages.

In this case, the entire SystemC package has to be

recompiled with kernel debugging enabled. I am not

sure SystemC kernel allows that. This is an interesting

issue, and so let us see what the elders/gurus say.

Posted

In a Windows environment (with MSVC), I had no issue to place a breakpoint and debug sc_simcontext.cpp (or any other SC kernel file), so I can guess you compiled part of the SC kernel with debug info while other files w/o it. All you need is to make sure you build it all with debug flag set.

 

Hope this helps,

Aaron

Posted

Hi Rohit,

  I would guess it's something to do with include paths and the location of the source files. When you compile the code, there is a whole set of -I options and includes that the compiler uses to find the source code. If gdb doesn't know about all those includes, I guess it can't find the source files. When you install SystemC, all the required header files end up in the include sub-directory - but the source (.cpp) files get left behind in the place you originally untarred the code. So my guess is that you need to tell gdb to look at the folder where you untarred systemc which includes a src directory containing the cpp files.

 

When you install on windows, you generally build the library in the same place, so the src directory is present.

 

Perhaps just copying the src folder into the final install directory would help?

 

regards

Alan

Posted

Thanks a lot Alan, 

 

Copying the source files from main directory to installed directory solved the issue. 

 

I am able to go inside simcontext.cpp and debug with breakpoints.

 

I am not so much used to working debugging with Microsoft Visual Studio as I work mostly in linux. Is there any link(tutorial) for how to set up systemc libraries in any other IDE for linux(eclipse ?) as working with gdb can be difficult at times.

 

Regards,

Rohit

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...