| | |
How to debug a C++ code which only runs on Fedora platform
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 11
Reputation:
Solved Threads: 1
Hi,
I recently has a C++ code which only run on Fedora Platform.
I wanted to run debugging on these code as I came across some unexplainable
scenario output.
Can anyone suggest how could I use any debugger? I tried to use GNU GDB but then the code I am dealing now are involving multiple files background. So, I am not too sure how to debug in this matter.
I also thought of porting to Visual C++, but I am not so sure how to.
Please advise. Thanks..
Rgrds,
Jason
I recently has a C++ code which only run on Fedora Platform.
I wanted to run debugging on these code as I came across some unexplainable
scenario output.
Can anyone suggest how could I use any debugger? I tried to use GNU GDB but then the code I am dealing now are involving multiple files background. So, I am not too sure how to debug in this matter.
I also thought of porting to Visual C++, but I am not so sure how to.
Please advise. Thanks..
Rgrds,
Jason
•
•
Join Date: Dec 2007
Posts: 11
Reputation:
Solved Threads: 1
Hi,
I tried to debug using GDB but since the code is large and wrap-up with Make; it cant point to the exact location of gdb.
The error which I get is cannot read run count from ./stamp-labels
For your information, the source file relates to multiple files. I am not so sure you guys would mind help me look at it.
If so, you could let me know and I try to make it available. I have been stucked for months and depressed
.
For your information, I try before to add some extra code inside but it doesnt work. And I try to understand the code but couldnt.
Please advise. Thanks.
I tried to debug using GDB but since the code is large and wrap-up with Make; it cant point to the exact location of gdb.
The error which I get is cannot read run count from ./stamp-labels
For your information, the source file relates to multiple files. I am not so sure you guys would mind help me look at it.
If so, you could let me know and I try to make it available. I have been stucked for months and depressed
.For your information, I try before to add some extra code inside but it doesnt work. And I try to understand the code but couldnt.
Please advise. Thanks.
•
•
Join Date: Mar 2008
Posts: 14
Reputation:
Solved Threads: 2
I can't be completely positive, but I'm almost sure that VC++ runs well under WINE, the windows duplication layer for Linux. I'm an Ubuntu user myself, but Fedora is debian based, so this should work (type it in the terminal):
That should install WINE for you. If not, check for the Fedora code for it.
Download VC++ and right-click the .exe, choosing open with. Select WINE Windows Emulator from the menu presented, and the install should start. Make sure it's VC++ 2005, as I'm pretty sure WINE doesn't yet have support for 2008.
I can't help with the debugging part, but that should get VC++ up and running for you so you can follow the advice of the other people on this forum.
EDIT: If you're not too apt to port, and would rather just debug, I suggest Geany. It's a great C++ IDE (as well as many others) and has a very easy to follow debugging tool built in.
C++ Syntax (Toggle Plain Text)
sudo apt-get install wine
Download VC++ and right-click the .exe, choosing open with. Select WINE Windows Emulator from the menu presented, and the install should start. Make sure it's VC++ 2005, as I'm pretty sure WINE doesn't yet have support for 2008.
I can't help with the debugging part, but that should get VC++ up and running for you so you can follow the advice of the other people on this forum.
EDIT: If you're not too apt to port, and would rather just debug, I suggest Geany. It's a great C++ IDE (as well as many others) and has a very easy to follow debugging tool built in.
C++ Syntax (Toggle Plain Text)
sudo apt-get install geany
Last edited by sinkingships7; Apr 8th, 2008 at 8:56 am.
•
•
Join Date: Dec 2007
Posts: 11
Reputation:
Solved Threads: 1
HI.
Thanks. I try download Eclipse and execute the debugger. However, it still gives me the same limited error which is:
"cannot read count from ./stamp-labels"
I am stuck and do not know how to proceed with this. The file of stamp-labels contain "100" and I just do not know what other debugging ways to append this "100" in order for debugging to work.
Please advise. Appreciate alot.
Thanks. I try download Eclipse and execute the debugger. However, it still gives me the same limited error which is:
"cannot read count from ./stamp-labels"
I am stuck and do not know how to proceed with this. The file of stamp-labels contain "100" and I just do not know what other debugging ways to append this "100" in order for debugging to work.
Please advise. Appreciate alot.
•
•
•
•
I can't be completely positive, but I'm almost sure that VC++ runs well under WINE, the windows duplication layer for Linux. I'm an Ubuntu user myself, but Fedora is debian based, so this should work (type it in the terminal):
That should install WINE for you. If not, check for the Fedora code for it.C++ Syntax (Toggle Plain Text)
sudo apt-get install wine
Download VC++ and right-click the .exe, choosing open with. Select WINE Windows Emulator from the menu presented, and the install should start. Make sure it's VC++ 2005, as I'm pretty sure WINE doesn't yet have support for 2008.
I can't help with the debugging part, but that should get VC++ up and running for you so you can follow the advice of the other people on this forum.
EDIT: If you're not too apt to port, and would rather just debug, I suggest Geany. It's a great C++ IDE (as well as many others) and has a very easy to follow debugging tool built in.
C++ Syntax (Toggle Plain Text)
sudo apt-get install geany
•
•
Join Date: Dec 2007
Posts: 11
Reputation:
Solved Threads: 1
Okay.
The code file is lectic.cc
Basically I am trying to understand some other people's code which is written in C++. This is basically a system which generates two files; tek.txt and lek.txt which are executed with 100 runs (100 test inputs). It generates 100 folder which have Outcome file and Label file.(I attached as folder 0, 1, 2). Supposed there are 100 of these folders with different values in these files. The code which generate these numbers is from lectic.cc.
However, I could not understand how these crunchy numbers are generated.
My initial guess is this function actually generated data for tek.txt and lek.txt.I do not understand how the numbers are generated especially with lek.txt ; the entry of "S: " is empty. Perhaps my understanding of the code is wrong. As what I understand so far, it first call cairns.cc file which gather information and do the counts in it.In this file, it has read_run function. In this function, I am not too sure how the while loop of
are doing. Does it means assigning value of 1 to every numRuns?
If that is the case, back in the file lectic.cc, every single is_srun[run_id] and is_frun[run_id] are always 1.
Perhaps its too vague after seeing the code, Do let me know because the original files are too large unless I can try upload in some server and you guys could download to see whole picture of it.
THanks.
The code file is lectic.cc
C++ Syntax (Toggle Plain Text)
#include <argp.h> #include <cassert> #include <cstdio> #include <ext/hash_map> #include <fstream> #include <iostream> #include <numeric> #include <queue> #include <vector> #include "CompactReport.h" #include "NumRuns.h" #include "PredStats.h" #include "Progress/Bounded.h" #include "ReportReader.h" #include "RunsDirectory.h" #include "RunSet.h" #include "OutcomeRunSets.h" #include "SiteCoords.h" #include "classify_runs.h" #include "fopen.h" #include "termination.h" #include "utils.h" using namespace std; using __gnu_cxx::hash_map; //////////////////////////////////////////////////////////////////////// // // information about one interesting predicate // struct PredInfo { OutcomeRunSets tek; OutcomeRunSets lek; }; class PredInfos : public hash_map<PredCoords, PredInfo> { }; static PredInfos predInfos; class Reader : public ReportReader { public: Reader(Outcome, unsigned); protected: void handleSite(const SiteCoords &, vector<count_tp> &); private: void notice(const SiteCoords &coords, unsigned, bool) const; const Outcome outcome; const unsigned runId; }; inline Reader::Reader(Outcome outcome, unsigned runId) : outcome(outcome), runId(runId) { } static void process_cmdline(int argc, char **argv) { static const argp_child children[] = { { &CompactReport::argp, 0, 0, 0 }, { &NumRuns::argp, 0, 0, 0 }, { &ReportReader::argp, 0, 0, 0 }, { &RunsDirectory::argp, 0, 0, 0 }, { 0, 0, 0, 0 } }; static const argp argp = { 0, 0, 0, 0, children, 0, 0 }; argp_parse(&argp, argc, argv, 0, 0, 0); }; int main(int argc, char** argv) { set_terminate_verbose(); process_cmdline(argc, argv); classify_runs(); ofstream ofp("tek.txt"); ofstream tfp("lek.txt"); // interesting predicates in "preds.txt" order typedef queue<const PredInfo *> InterestingPreds; InterestingPreds interesting; { const unsigned numPreds = PredStats::count(); Progress::Bounded progress("reading interesting predicate list", numPreds); FILE * const pfp = fopenRead(PredStats::filename); pred_info pi; while (read_pred_full(pfp, pi)) { progress.step(); const PredInfo &info = predInfos[pi]; interesting.push(&info); } fclose(pfp); } [B] { Progress::Bounded progress("computing tek lek", NumRuns::count()); for (unsigned runId = NumRuns::begin; runId < NumRuns::end; ++runId) { progress.step(); Outcome outcome = 0; if (is_srun[runId]) outcome = &OutcomeRunSets::success; else if (is_frun[runId]) outcome = &OutcomeRunSets::failure; else continue; Reader(outcome, runId).read(runId); } } [/B] { Progress::Bounded progress("printing tek and lek", predInfos.size()); while (!interesting.empty()) { progress.step(); const PredInfo * const info = interesting.front(); ofp << info->tek ; tfp << info->lek; interesting.pop(); } } return 0; }
However, I could not understand how these crunchy numbers are generated.
My initial guess is this function actually generated data for tek.txt and lek.txt.I do not understand how the numbers are generated especially with lek.txt ; the entry of "S: " is empty. Perhaps my understanding of the code is wrong. As what I understand so far, it first call cairns.cc file which gather information and do the counts in it.In this file, it has read_run function. In this function, I am not too sure how the while loop of
C++ Syntax (Toggle Plain Text)
while (file >> runId && runId < numRuns) { progress.stepTo(runId); if (runId >= NumRuns::begin) { bits[runId] = 1; ++count; } }
If that is the case, back in the file lectic.cc, every single is_srun[run_id] and is_frun[run_id] are always 1.
Perhaps its too vague after seeing the code, Do let me know because the original files are too large unless I can try upload in some server and you guys could download to see whole picture of it.
THanks.
Last edited by Narue; Apr 9th, 2008 at 1:51 pm. Reason: Added code tags
![]() |
Other Threads in the C++ Forum
- Previous Thread: create and work with Word document from VC++
- Next Thread: atol vs strtol
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game generator givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






