please choosego to mobile | Continue to access the PC version
View: 9214|Reply: 8

Debugging orange pi zero with gdb

[Copy link]

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
Published in 2017-3-22 17:35:08 | Show all floors |Read mode
I am trying to get a good workflow going with my orange pi zero.
I have installed the latest armbian image
Upgrade it and installed the latest dev tools.
I created a file called hello.c
```
#include <stdio.h>

int main (void)
    {
        printf("hello, world!\n");
        return 0;
    }

```
compiled with g++ and -g for symbols.
#./hello
hello, world!

all good

but
#gdb ./hello
(gdb) r
Starting program: /root/src/WiringOP-Zero/examples/hello

Program received signal SIGSEGV, Segmentation fault.
0xb6fd9822 in ?? () from /lib/ld-linux-armhf.so.3
(gdb)


Im sure if i can get this working then my remote debugging will work also.

Any help would be appreciated.
Cheers.

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-22 22:20:19 | Show all floors
thanks. But how do i apply the patch. Sorry. new to linux.

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-23 03:18:07 | Show all floors
Thanks for your help. To be honest, i'm a bit disappointed in this platform. I expected there would be some way to debug Orange PI being a native windows programmer i have had the luxury of things just working and being spoilt for choice but this is fundamental as GDB if the basis of all the frontend interactive debuggers for linux c development.
Maybe i should have just go a raspberry pi after all.
If anyone has a first class deve workflow (that works) for working with orange pi zero i would interested to know about it.

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-23 11:32:45 | Show all floors
this needs to be ported to the orange pi version and updated. Apparently this did not work for allwiner.
https://github.com/raspberrypi/linux/issues/766
Do you know who i can pass this onto?

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2017-3-23 14:08:24 | Show all floors


Do you log in by the root user?

If you log in other user, what happens?

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-25 06:18:19 | Show all floors
i only have root. I dont see any point in creating another use. i want full access always. But really?

3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-25 06:19:15 | Show all floors
@nopnop2002 do you really think if i created a non-root user it would behave differently?

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2017-3-25 14:19:31 | Show all floors
Edited by nopnop2002 at 2017-3-25 14:54
juxtapos replied at 2017-3-25 06:19
@nopnop2002 do you really think if i created a non-root user it would behave differently?

The login user is probably unrelated.
It may be a permission.
  1. orangepi@orangepizero:~/test$ cc -o test2 test2.c -g
  2. orangepi@orangepizero:~/test$ gdb ./test2
  3. GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
  4. Copyright (C) 2014 Free Software Foundation, Inc.
  5. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  6. This is free software: you are free to change and redistribute it.
  7. There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  8. and "show warranty" for details.
  9. This GDB was configured as "arm-linux-gnueabihf".
  10. Type "show configuration" for configuration details.
  11. For bug reporting instructions, please see:
  12. <http://www.gnu.org/software/gdb/bugs/>.
  13. Find the GDB manual and other documentation resources online at:
  14. <http://www.gnu.org/software/gdb/documentation/>.
  15. For help, type "help".
  16. Type "apropos word" to search for commands related to "word"...
  17. Reading symbols from ./test2...done.
  18. (gdb) list
  19. 1       #include <stdio.h>
  20. 2
  21. 3       int main (void)
  22. 4           {
  23. 5               printf("hello, world!\n");
  24. 6               return 0;
  25. 7           }
  26. (gdb) break main
  27. Breakpoint 1 at 0x103d8: file test2.c, line 5.
  28. (gdb) run
  29. Starting program: /home/orangepi/test/test2

  30. Breakpoint 1, main () at test2.c:5
  31. 5               printf("hello, world!\n");
  32. (gdb)
Copy code




3

threads

10

posts

39

credits

Novice

Rank: 1

credits
39
 Author| Published in 2017-3-28 15:13:10 | Show all floors
not sure, installed debian server (not ubuntu) that works fine now. Now i have done something to it and it wont boot up. but thats a diffferent issue.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list