User forums > General (but related to Code::Blocks)
Gcov
MortenMacFly:
...found a bug (which crashes C::B):
If you have a virtual target active, this line:
--- Code: ---wxFileName objname(prj->GetBuildTarget(prj->GetActiveBuildTarget())->GetObjectOutput() + sep + prjfile->GetObjName());
--- End code ---
...in void cbGcov::GcovProject(cbProject* prj) will crash C::B because prj->GetBuildTarget(prj->GetActiveBuildTarget()) will be a NULL pointer. You cannot rely on obtaining a valid build target always, so you need to verify this.
Edit: Also, in the same method I see two more crash candidates:
Accessing a project pointer without verification:
--- Code: ---void cbGcov::GcovProject(cbProject* prj)
{
m_JobsWorkingdir = prj->GetBasePath();
--- End code ---
...accessing a project file pointer without verification:
--- Code: --- ProjectFile *prjfile = prj->GetFile(k);
if(prjfile->compile)
--- End code ---
Be careful! Always verify what you get.
danselmi:
--- Quote from: ewww on March 22, 2011, 01:09:33 pm ---... anyone has got a good idea how to display the more detailed statistics in cb editor windows, you are welcome to share the knowledge :) More specifically I am talking about branch and call stats. Adding those next to line call count isn't that pretty at all, dont you think?
--- End quote ---
Does nobody have an idea? Perhaps it is not suitable to show in the editor (http://ggcov.sourceforge.net/ has some additional views).
oBFusCATed:
Probably you can see how cbDiff draws something in the margin: http://forums.codeblocks.org/index.php/topic,12829.0.html
See here: http://img704.imageshack.us/img704/958/cbdifftab.png
and here: http://img682.imageshack.us/img682/3875/cbdiffsbs.png
ewww:
Hi
One more update, possibly a final one :)
* Checking more pointers for validity, as suggested.
* Clean project/workspace removes the corresponding .gcno .gcda files
* When running cbGcov on workspace, after each project is finished the open editor windows are updated for that project
Known limitation: Newly opening an editor window will update it with gcov info only if it is a part of the currently active project. This should not be a problem, if I could get cbProject* in cbGcov::OnEditorOpen()
--- Code: ---void cbGcov::OnEditorOpen(CodeBlocksEvent &event)
{
EditorBase * eb = event.GetEditor();
cbProject* prj = event.GetProject(); // this is always null?
if(!eb || !eb->IsBuiltinEditor())
{
return;
}
cbEditor *ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(eb);
if(!ed)
{
return;
}
if (!prj && ed->GetProjectFile()) // ed->GetProjectFile() always NULL too?
{
prj = ed->GetProjectFile()->GetParentProject();
}
ShowCovData(ed,prj);
}
--- End code ---
I am unable to get the cbProject out of the event even when the file opened does belong to a project. How can I do that?
Or... should I really build the proper SDK? ;)
MortenMacFly:
--- Quote from: ewww on March 25, 2011, 03:31:52 pm ---One more update, possibly a final one :)
--- End quote ---
not really, unfortunately. The crash remains as you did only half the way.
This line:
--- Code: ---wxString objOutput = prj->GetBuildTarget(prj->GetActiveBuildTarget())->GetObjectOutput();
--- End code ---
...in void cbGcov::CleanProject(cbProject* prj) will still crash if you have activated a virtual target.
You also need to verify the return value of:
--- Code: ---prj->GetBuildTarget(prj->GetActiveBuildTarget())
--- End code ---
...as I had written btw..
The idea is good, but I really think this plugin needs way more testing. I was my #1 crash candidate the last couple of days even I did no use it. :?
...also, this: _(".gcda") makes no sense. You don't want to translate the file extension, don't you? use _T() or wxT() instead for strings you don't want to translate... but that's only minor.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version