Trying to Debug C++ Program on Eclipse Mars on MAC Pro Retina with OS X Yosemite Version 10.10.5 -


i trying debug below c++ program on new mac in eclipse mars.

i able build project (which generates output file).

i able run 'local c++ application' not generate output file seems completing successfully.

but unable debug says ...

i tried different options in 'debug configurations' no luck ...

'could not determine gdb version using command: /usr/bin --version' ...

'no such debugger'

error creating session cannot run program "gdb": unknown reason cannot run program "gdb": unknown reason cannot run program "gdb": unknown reason

could not determine gdb version using command: /usr/bin --version

"error while launching command: gdb --version"

what doing wrong ? appreciated.

 /*   e-mail : ahmed.aly.tc@gmail.com  topcoder handle : ahmed_aly   :)   */  #include <cstring> #include <string.h> #include <map> #include <deque> #include <queue> #include <stack> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <algorithm> #include <vector> #include <set> #include <complex> #include <list>  using namespace std;  #define pb push_back #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define sz size() #define rep(i,m) for(int i=0;i<(int)(m);i++) #define rep2(i,n,m) for(int i=n;i<(int)(m);i++) #define for(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();++it) #define mem(a,b) memset(a,b,sizeof(a)) #define mp make_pair #define dot(a,b) ((conj(a)*(b)).x) #define x real() #define y imag() #define length(v) (hypot((v).x,(v).y)) #define vect(a,b) ((b)-(a)) #define cross(a,b) ((conj(a)*(b)).imag()) #define normalize(v) ((v)/length(v)) #define rotate(p,about,theta) ((p-about)*exp(point(0,theta))+about) #define pointequ(a,b) (comp(a.x,b.x)==0 && comp(a.y,b.y)==0)  typedef stringstream ss; typedef pair<int, int> pii; typedef vector<pii> vpii; typedef vector<string> vs; typedef vector<int> vi; typedef vector<double> vd; typedef vector<vector<int> > vii; typedef long long ll; typedef long double ld; typedef complex<double> point; typedef pair<point, point> segment; typedef pair<double, point> circle; typedef vector<point> polygon;  const int oo = (int) 1e9; const double pi = 2 * acos(0); const double eps = 1e-9;  inline int comp(const double &a, const double &b) {     if (fabs(a - b) < eps)         return 0;     return > b ? 1 : -1; }  int di[] = { 1, -1, 0, 0, 1, -1, 1, -1 }; int dj[] = { 0, 0, 1, -1, 1, -1, -1, 1 }; int dik[] = { -2, -2, -1, 1, 2, 2, 1, -1 }; int djk[] = { -1, 1, 2, 2, 1, -1, -2, -2 };  int i, j;  inline bool val(const int &i, const int &j) {     if (i < 0 || j < 0 || >= || j >= j)         return false;     return true; }  int n; int n;   int arr[2009]; //#define small #define large int main() {     freopen("a.txt", "rt", stdin); #ifdef small     freopen("a-small-attempt0.in","rt",stdin);     freopen("a-small.out","wt",stdout); #endif #ifdef large     freopen("a-large.in","rt",stdin);     freopen("a-large.out","wt",stdout); #endif      int c;     cin >> n;     rep2(nn,1,n+1) {         cin>>c>>n;         rep(i,n)             cin>>arr[i];          printf("case #%d: ", nn);         rep(i,n)             rep2(j,i+1,n)                 if(arr[i]+arr[j]==c){                     cout<<i+1<<" "<<j+1<<endl;                     goto end;                 }         end:;     }     return 0; } 

apple hasn't shipped gdb tools quite while now. can download , build fsf gdb, have no idea how works on os x. apple added lot of functionality version of gdb shipped in day never made fsf source base.

the debugger apple supports lldb. can use lldb eclipse through lldb-mi driver. doing described instance here:

https://www.codeplay.com/portal/lldb-mi-driver---part-2-setting-up-the-driver

note if have xcode 7.x, includes lldb-mi driver program in xcode.app/contents/developer/usr/bin/lldb-mi, don't have go through steps in 2.1 above.


Comments