All of lore.kernel.org
 help / color / mirror / Atom feed
* [libgpiod] segfault with function gpiod_chip_get_all_lines(chip, &bulk);
@ 2019-12-27 21:44 John Rose
  2020-01-08  9:03 ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: John Rose @ 2019-12-27 21:44 UTC (permalink / raw)
  To: linux-gpio

SBC:    HardKernel Odroid N2 4Gb.
OS:     Ubuntu 18.04.3 Mate' DE.
        Linux odroid_N2 4.9.196-63 #1 SMP PREEMPT Thu Oct 17 00:44:03
-03 2019 aarch64 aarch64 aarch64 GNU/Linux
------------------------------------------------------
A basic test of the gpiod_chip_get_all_lines function.
------------------------------------------------------
/*--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
 * libgpio_test_03
 *
 *
 *
 */
/*******gdb debugger
error********************************************************************************************************
t3st3r1@odroid_N2:~$ sudo gdb c_projects/libgpio_test_03/main
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 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 "aarch64-linux-gnu".
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 c_projects/libgpio_test_03/main...done.
(gdb) run
Starting program: /home/t3st3r1/c_projects/libgpio_test_03/main
OdroidN2 -- Ubuntu 18.04.3 LTS
libgpio_test_03

gpiod_chip_open() OK.


Program received signal SIGSEGV, Segmentation fault.
0x0000007fb7fa48d0 in gpiod_line_bulk_add (line=0x555556a910,
bulk=0x7ffffff2a0) at ../include/gpiod.h:578
578 bulk->lines[bulk->num_lines++] = line;
(gdb)
*********************************************************************************************************************************/

#include "main.h"

#ifndef HIGH
#define HIGH 1
#endif

#ifndef LOW
#define LOW 0
#endif

//--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
// Main function.
//
int main(int argc, char** argv) {
fprintf(stdout, "OdroidN2 -- Ubuntu 18.04.3 LTS\nlibgpio_test_03\n\n");

struct  gpiod_chip*     chip;
struct gpiod_line_bulk bulk;
struct gpiod_line      *line;
int offset;
const char *string;
// Open/access a specific gpiochip.
// GPIOX_0 ...GPIOX_19
//
chip = gpiod_chip_open("/dev/gpiochip1");
if (!chip) {
perror("gpiod_chip_open()");
return -1;
}
else
fprintf(stdout, "gpiod_chip_open() OK.\n\n");
// Bulk get of all gpiochip1 lines.
//********************************
// ***** Generates a segfault ****
//********************************
//
if (gpiod_chip_get_all_lines(chip, &bulk) != 0) {
perror("gpiod_chip_get_all_lines()");
return -1;
}

gpiod_chip_close(chip);
fprintf(stdout, "Exiting.\n");
return EXIT_SUCCESS;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libgpiod] segfault with function gpiod_chip_get_all_lines(chip, &bulk);
  2019-12-27 21:44 [libgpiod] segfault with function gpiod_chip_get_all_lines(chip, &bulk); John Rose
@ 2020-01-08  9:03 ` Bartosz Golaszewski
  2020-01-20 20:16   ` John Rose
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-01-08  9:03 UTC (permalink / raw)
  To: John Rose; +Cc: open list:GPIO SUBSYSTEM

pt., 27 gru 2019 o 22:44 John Rose <ohimg801@gmail.com> napisał(a):
>
> SBC:    HardKernel Odroid N2 4Gb.
> OS:     Ubuntu 18.04.3 Mate' DE.
>         Linux odroid_N2 4.9.196-63 #1 SMP PREEMPT Thu Oct 17 00:44:03
> -03 2019 aarch64 aarch64 aarch64 GNU/Linux
> ------------------------------------------------------
> A basic test of the gpiod_chip_get_all_lines function.
> ------------------------------------------------------
> /*--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
>  * libgpio_test_03
>  *
>  *
>  *
>  */
> /*******gdb debugger
> error********************************************************************************************************
> t3st3r1@odroid_N2:~$ sudo gdb c_projects/libgpio_test_03/main
> GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
> Copyright (C) 2018 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 "aarch64-linux-gnu".
> 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 c_projects/libgpio_test_03/main...done.
> (gdb) run
> Starting program: /home/t3st3r1/c_projects/libgpio_test_03/main
> OdroidN2 -- Ubuntu 18.04.3 LTS
> libgpio_test_03
>
> gpiod_chip_open() OK.
>
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000007fb7fa48d0 in gpiod_line_bulk_add (line=0x555556a910,
> bulk=0x7ffffff2a0) at ../include/gpiod.h:578
> 578 bulk->lines[bulk->num_lines++] = line;
> (gdb)

The problem seems to be gone in current master. I get the following output:

---
OdroidN2 -- Ubuntu 18.04.3 LTS
libgpio_test_03

gpiod_chip_open() OK.

Exiting.
---

Bartosz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libgpiod] segfault with function gpiod_chip_get_all_lines(chip, &bulk);
  2020-01-08  9:03 ` Bartosz Golaszewski
@ 2020-01-20 20:16   ` John Rose
  0 siblings, 0 replies; 3+ messages in thread
From: John Rose @ 2020-01-20 20:16 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: open list:GPIO SUBSYSTEM

Ok, thanks.

On Wed, Jan 8, 2020 at 3:03 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> pt., 27 gru 2019 o 22:44 John Rose <ohimg801@gmail.com> napisał(a):
> >
> > SBC:    HardKernel Odroid N2 4Gb.
> > OS:     Ubuntu 18.04.3 Mate' DE.
> >         Linux odroid_N2 4.9.196-63 #1 SMP PREEMPT Thu Oct 17 00:44:03
> > -03 2019 aarch64 aarch64 aarch64 GNU/Linux
> > ------------------------------------------------------
> > A basic test of the gpiod_chip_get_all_lines function.
> > ------------------------------------------------------
> > /*--+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
> >  * libgpio_test_03
> >  *
> >  *
> >  *
> >  */
> > /*******gdb debugger
> > error********************************************************************************************************
> > t3st3r1@odroid_N2:~$ sudo gdb c_projects/libgpio_test_03/main
> > GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
> > Copyright (C) 2018 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 "aarch64-linux-gnu".
> > 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 c_projects/libgpio_test_03/main...done.
> > (gdb) run
> > Starting program: /home/t3st3r1/c_projects/libgpio_test_03/main
> > OdroidN2 -- Ubuntu 18.04.3 LTS
> > libgpio_test_03
> >
> > gpiod_chip_open() OK.
> >
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x0000007fb7fa48d0 in gpiod_line_bulk_add (line=0x555556a910,
> > bulk=0x7ffffff2a0) at ../include/gpiod.h:578
> > 578 bulk->lines[bulk->num_lines++] = line;
> > (gdb)
>
> The problem seems to be gone in current master. I get the following output:
>
> ---
> OdroidN2 -- Ubuntu 18.04.3 LTS
> libgpio_test_03
>
> gpiod_chip_open() OK.
>
> Exiting.
> ---
>
> Bartosz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-20 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 21:44 [libgpiod] segfault with function gpiod_chip_get_all_lines(chip, &bulk); John Rose
2020-01-08  9:03 ` Bartosz Golaszewski
2020-01-20 20:16   ` John Rose

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.