Skip to content

Commit 7b27c4a

Browse files
committed
more MacOS gdb fixes
1 parent 32ff6db commit 7b27c4a

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ifdef NOTHREADS
6262
BASEFLAGS += -DNOTHREADS
6363
endif
6464

65-
#ifneq (,$(findstring release,$(MAKECMDGOALS)))
65+
DMACH := $(shell g++ -dumpmachine)
6666

6767
ifneq (,$(filter %release %static, $(MAKECMDGOALS)))
6868
# -- release build
@@ -91,6 +91,9 @@ else
9191
#just plain debug build
9292
DEBUG_BUILD=1
9393
CXXFLAGS := $(if $(CXXFLAGS),$(CXXFLAGS),-g -O0)
94+
ifneq (, $(findstring darwin, $(DMACH)))
95+
CXXFLAGS += -gdwarf-3
96+
endif
9497
CXXFLAGS += -DDEBUG -D_DEBUG -DGDEBUG $(BASEFLAGS)
9598
endif
9699
endif
@@ -150,6 +153,7 @@ stringtie: ${BAM}/libbam.a $(OBJS) stringtie.o
150153
# target for removing all object files
151154

152155
clean:
156+
echo $(PATH)
153157
${RM} stringtie${EXE} stringtie.o* $(OBJS)
154158
${RM} core.*
155159
allclean cleanAll cleanall:

gclib/GArgs.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "GArgs.h"
33
#include <ctype.h>
44

5-
GArgs::GArgs(int argc, char* const argv[], const char* format, bool nodigitopts) {
5+
GArgs::GArgs(int argc, char* argv[], const char* format, bool nodigitopts) {
66
/* format can be:
77
<string>{;|=} e.g. disable-test;PID=S= for --disable-test PID=50 (or --PID 50) S=3.5 etc.
88
<letter>[:] e.g. p:hT for -p testing (or -ptesting) -h -T
@@ -63,20 +63,24 @@ while (fstr-format < fmtlen ) {
6363
//-- now parse the arguments based on the given format specification
6464
parseArgs(nodigitopts);
6565
}
66-
66+
67+
void dbg_dequote(char* &p) {
68+
int alen=strlen(p);
69+
if (alen>1 && p[0]=='\'' && p[alen-1]=='\'') {
70+
p++;
71+
p[alen-2 ]='\0';
72+
}
73+
}
74+
6775
int GArgs::parseArgs(bool nodigitopts) {
6876
int p=1; //skip program name
6977
int f=0;
7078
while (p<_argc) {
71-
/* silly patch for annnoying OSX gdb issues:
79+
// silly patch for annnoying MacOS gdb/eclipse issues:
7280
#if defined(__APPLE__) && defined(DEBUG)
73-
int alen=strlen(_argv[p]);
74-
if (alen>1 && _argv[p][0]=='\'' && _argv[p][alen-1]=='\'') {
75-
_argv[p]++;
76-
_argv[p][alen-1]='\0';
77-
}
81+
dbg_dequote(_argv[p]);
7882
#endif
79-
*/
83+
//--
8084
if (_argv[p][0]=='-' && (_argv[p][1]==0 || _argv[p][1]!='-')) {
8185
//single-dash argument
8286
int cpos=1;
@@ -119,8 +123,11 @@ int GArgs::parseArgs(bool nodigitopts) {
119123
if (_argv[p][cpos+1]=='\0') {
120124
if (p+1<_argc && _argv[p+1][0]!=0) { //value is the whole next argument
121125
p++;
126+
#if defined(__APPLE__) && defined(DEBUG)
127+
dbg_dequote(_argv[p]);
128+
#endif
122129
args[count].value=Gstrdup(_argv[p]);
123-
}
130+
}
124131
else {
125132
errarg=p;
126133
err_valmissing=true;
@@ -234,7 +241,7 @@ void GArgs::printCmdLine(FILE* fout) {
234241
}
235242
}
236243

237-
GArgs::GArgs(int argc, char* const argv[], const GArgsDef fmtrecs[], bool nodigitopts) {
244+
GArgs::GArgs(int argc, char* argv[], const GArgsDef fmtrecs[], bool nodigitopts) {
238245
fmtcount=0;
239246
count=0;
240247
nonOptCount=0;

gclib/GArgs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class GArgs {
4444
//int code; // if GArgsDef[] constructor was used, for getOpt
4545
};
4646
int _argc;
47-
char* const *_argv; //the original main() values
47+
char** _argv; //the original main() values
4848
argdata* args; //arguments table after parsing it
4949
int count; //total count of elements in 'args' array
5050
int nonOptCount; //count of non-dashed, non= arguments
@@ -59,14 +59,14 @@ class GArgs {
5959
int validLongOpt(char* o, char* to);
6060
public:
6161

62-
GArgs(int argc, char* const argv[], const char* format, bool nodigitopts=false);
62+
GArgs(int argc, char* argv[], const char* format, bool nodigitopts=false);
6363
/* format can be:
6464
<string>{;|=} e.g. disable-test;PID=S= for --disable-test PID=50 (or --PID 50) S=3.5 etc.
6565
<letter>[:] e.g. p:hT for -p testing (or -ptesting) -h -T
6666
This means that the long options, if present, should be given at the beginning
6767
of the format string, before the single-dash, single-char options
6868
*/
69-
GArgs(int argc, char* const argv[], const GArgsDef fmtrecs[], bool nodigitopts=false);
69+
GArgs(int argc, char* argv[], const GArgsDef fmtrecs[], bool nodigitopts=false);
7070

7171
~GArgs();
7272
int isError(); // returns the offending argv position or 0 if no error

stringtie.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int waitForData(BundleData* bundles);
248248

249249
TInputFiles bamreader;
250250

251-
int main(int argc, char * const argv[]) {
251+
int main(int argc, char* argv[]) {
252252

253253
// == Process arguments.
254254
GArgs args(argc, argv,

0 commit comments

Comments
 (0)