Running the app under gdb on a mac requires codesign, but under lldb it
doesn't, so here's something that you could do. Change the last line on
"hw/bsp/native/native_debug.sh" from:

gdb -x $GDB_SCRIPT_PATH $FILE_NAME

to:

lldb $FILE_NAME

That should be enough to enable you to debug your app.

Cheers,
Fabio Utzig

On Fri, Feb 10, 2017, at 03:18 AM, Sterling Hughes wrote:
> Yup, unfortunately nothing for that.
> 
> Mac makes you code sign gdb when running sim.  If you run on physical 
> hardware, you don’t need to codesign the binary.
> 
> Sterling
> 
> On 9 Feb 2017, at 20:50, Denis Magda wrote:
> 
> > Hi Marko,
> >
> >> cd $GOPATH/src/newt/mynewt.apache.org/newt
> >> git checkout mynewt_1_0_0_b2_rc1_tag
> >> cd newt
> >> go build; go install
> >
> > This did the trick, thanks!
> >
> > However, I managed to run the demo only under the root user (sudo newt 
> > run my_blinky_sim). The other option was to codesign the gdb.
> >
> > Otherwise, I got the exception below. Please update “Run the 
> > Project” section of the getting started guide putting a note 
> > regarding this possible issue.
> >
> >
> > Deniss-MBP:test dmagda$ newt run my_blinky_sim
> > Loading app image into slot 1
> > [/Users/dmagda/dev/test/test/repos/apache-mynewt-core/hw/bsp/native/native_debug.sh
> >  
> > /Users/dmagda/dev/test/test/repos/apache-mynewt-core/hw/bsp/native 
> > /Users/dmagda/dev/test/test/bin/targets/my_blinky_sim/app/apps/blinky/blinky]
> > Debugging 
> > /Users/dmagda/dev/test/test/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf
> > GNU gdb (GDB) 7.12.1
> > Copyright (C) 2017 Free Software Foundation, Inc.
> > License GPLv3+: GNU GPL version 3 or later 
> > <http://gnu.org/licenses/gpl.html>
> > This is free software: you are free to change and redistribute it.
> > There is NO WARRANTY, to the extent permitted by law.  Type "show 
> > copying"
> > and "show warranty" for details.
> > This GDB was configured as "x86_64-apple-darwin16.3.0".
> > Type "show configuration" for configuration details.
> > For bug reporting instructions, please see:
> > <http://www.gnu.org/software/gdb/bugs/>.
> > Find the GDB manual and other documentation resources online at:
> > <http://www.gnu.org/software/gdb/documentation/>.
> > For help, type "help".
> > Type "apropos word" to search for commands related to "word"...
> > Reading symbols from 
> > /Users/dmagda/dev/test/test/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf...Reading
> >  
> > symbols from 
> > /Users/dmagda/dev/test/test/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf.dSYM/Contents/Resources/DWARF/blinky.elf...done.
> > done.
> > (gdb) r
> > Starting program: 
> > /Users/dmagda/dev/test/test/bin/targets/my_blinky_sim/app/apps/blinky/blinky.elf
> > Unable to find Mach task port for process-id 35941: (os/kern) failure 
> > (0x5).
> >  (please check gdb is codesigned - see taskgated(8))
> > (gdb)
> >
> > —
> > Denis
> >
> >> On Feb 9, 2017, at 6:58 PM, marko kiiskila <[email protected]> wrote:
> >>
> >> Hi Denis,
> >>
> >> I think Chris meant output of ‘newt -ldebug build my_blinky_sim’
> >>
> >> What looks confusing is the the contents of build_log.rtf.
> >> It looks as if the file in question was getting processed twice:
> >> First with gcc-6, and then with clang. And it’s the second 
> >> invocation that’s
> >> causing this error.
> >>
> >> Obviously, only the first step should take place. So there’s 
> >> possibly
> >> something funky going on with newt. But I don’t know what could
> >> cause this kind of error. Can you double-check the go version
> >> you’re using?
> >>
> >> Also, could you try with the latest beta2 (close to being released)?
> >>
> >> cd $GOPATH/src/newt/mynewt.apache.org/newt
> >> git checkout mynewt_1_0_0_b2_rc1_tag
> >> cd newt
> >> go build; go install
> >>
> >> And then go through the project creation part again.
> >>
> >>
> >>> On Feb 9, 2017, at 5:40 PM, Denis Magda <[email protected]> wrote:
> >>>
> >>> Hi Chris,
> >>>
> >>> Please find requested data attached here:
> >>> https://drive.google.com/open?id=0B0qn42TRMz5EV1JobzBqM1loa3c 
> >>> <https://drive.google.com/open?id=0B0qn42TRMz5EV1JobzBqM1loa3c>
> >>>
> >>> As for “-ldebug” it has no effect for me. Tried to add it to 
> >>> many parameters from compiler.yml with no success.
> >>> However, “-v” command generated verbose output at the time the 
> >>> compilation of the assembly file failed.
> >>>
> >>> —
> >>> Denis
> >>>
> >>>
> >>>> On Feb 9, 2017, at 8:48 AM, Christopher Collins 
> >>>> <[email protected]> wrote:
> >>>>
> >>>> Hi Denis,
> >>>>
> >>>> On Wed, Feb 08, 2017 at 09:39:10PM -0800, Denis Magda wrote:
> >>>>> Hello Mynewt community,
> >>>>>
> >>>>> I tried to play with your product strictly following the getting 
> >>>>> started guide [1] but can’t compile the default blinky app
> >>>>>
> >>>>> Deniss-MBP:test dmagda$ newt build my_blinky_sim
> >>>>> Building target targets/my_blinky_sim
> >>>>> Assembling os_arch_stack_frame.s
> >>>>> Error: os_arch_stack_frame.s:34:17: error: unexpected token in 
> >>>>> directive
> >>>>>  .globl CNAME(os_arch_frame_init)
> >>>>>              ^
> >>>>> os_arch_stack_frame.s:39:26: error: unexpected token in argument 
> >>>>> list
> >>>>> CNAME(os_arch_frame_init):
> >>>>>                       ^
> >>>>> os_arch_stack_frame.s:84:19: error: unexpected token in memory 
> >>>>> operand
> >>>>>  call    CNAME(sigsetjmp)        /* sigsetjmp(sf->sf_jb, 0) */
> >>>>>                ^
> >>>>> os_arch_stack_frame.s:98:19: error: unexpected token in memory 
> >>>>> operand
> >>>>>  call    CNAME(os_arch_task_start) /* os_arch_task_start(sf, rc) 
> >>>>> */
> >>>>
> >>>> Hmm, that's odd.  I don't have any theories, but I'll look into it.
> >>>> Could you please post the following:
> >>>>
> >>>> * Contents of compiler/sim/compiler.yml
> >>>> * Output of "gcc-6 -v" (or whatever your gcc binary is called)
> >>>>
> >>>> Another option that could be helpful is to try building with the
> >>>> "-ldebug" command line switch.  This will enable a lot of debug 
> >>>> output,
> >>>> including the actual command used to assemble that .s file.
> >>>>
> >>>> Thanks,
> >>>> Chris
> >>>>
> >>>>
> >>>>>
> >>>>>
> >>>>> The dev environment is the following:
> >>>>> * macOS Sierra
> >>>>> * newt, gcc and gdb are natively installed
> >>>>> - newt version: Apache Newt (incubating) version: 1.0.0-dev
> >>>>> - gcc version: gcc version 6.3.0 (Homebrew GCC 6.3.0_1)
> >>>>> * gcc-5 replaced with gcc-6 in compiler.yml according to this doc 
> >>>>> [2].
> >>>>>
> >>>>>
> >>>>> Am I missing something or doing something wrong?
> >>>>>
> >>>>> [1] 
> >>>>> https://mynewt.incubator.apache.org/os/get_started/project_create/
> >>>>> [2] 
> >>>>> https://mynewt.incubator.apache.org/os/get_started/native_tools/
> >>>>>
> >>>>> —
> >>>>> Denis
> >>>
> >>

Reply via email to