[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: smoothing Xcode integration
From: |
Hans Åberg |
Subject: |
Re: smoothing Xcode integration |
Date: |
Sat, 6 Oct 2018 15:40:29 +0200 |
> On 6 Oct 2018, at 14:42, Uxio Prego <address@hidden> wrote:
>
> On StackOverflow I've been given some directions on getting Xcode
> to correctly use a cross platform Makefile, however haven't been
> completely successful so far.
>
> I can add a target wrapping the Makefile, but haven't passed the
> environment variables to the `make` execution successfully yet,
> for it to remove the _line_ preprocessor directives.
>
> Also I haven't figured out yet how to configure that Make target as
> a build step before the program target itself.
This is setup with configure for just using Xcode as a debugger, building the
project in the directory project/ using 'make' from Terminal:
1. Name a sibling directory to the directory project/, say 'xcode', and move to
it ('cd xcode').
2. In the xcode directory, create a Makefile using
../project/configure CXX=clang++ CXXFLAGS=-g
or whatever path to the compiler, and make. This also create a subdirectory
called 'src'
3. From within Xcode, create in the directory 'xcode' an "External Build"
project named 'src', which puts a file src.xcodeproj in the directory xcode/src.
4. Add 'project/src' to the project by dragging into the project window in the
left sidebar.
5. Open scheme from the pop-up top left in the project window, or keyboard
<command>-'<' if already selected.
6. If the project is run from say the directory 'test', set its full path in
Options.
5. If the program is from this directory 'test' using say
../xcode/src/project <arguments>
set the arguments in Arguments.
>>> I would want to run `sed 's/#line/\/\/#line/'` on the generated parser
>>> in order for it not to show as assembly during debugging. I think
>>> Xcode has some kind of non honoring to the way `#line` works,
>>
>> You can disable using %no-lines, see the Bison manual, but it works fine in
>> Xcode 10.
>
> Nice to know, however maybe the `sed` use is more convenient.
> The default flow must be not to manipulate _line_ preprocessor
> directives.
>
> If I added `%no-lines`, would GDB debugging break?
> I'd try once I have a Linux box at hand again...
>
> So unless nothing breaks, injecting a `%no-lines` line in the Bison
> doc, I see unnecessarily complicated compared to optionally run
> a simple `sed` substitution on the generated parser.
The #line directives just causes the debugger to show that part instead of the
.cc sources when encountering an error. For example, a thrown exception will
show the correct line in the .yy file. Breakpoints must still be put in the .cc
sources.