Specs:
rtl3.1 with linux 2.4.18 (sourced from
http://bernia.disca.upv.es/rtportal) on an i386 RedHat7.3 system; 
gdb-5.1.90CVS-5

I have compiled a modified version of the
$(RTLINUX_DIR)/examples/hello.c program to familiarise myself with the
debugging process (the source is included hereunder as also the commands
used to compile the source)

(All lines with a '>' preceding are source and terminal outputs)

> 
>/*****************************************************************************************************************
>  
>*****************************************************************************************************************
> 
> #include <rtl.h>
> #include <time.h>
> #include <pthread.h>
> #include <rtl_debug.h>
> 
> pthread_t thread = NULL;
> 
> void * start_routine(void *arg) {
> 
>         
> // Most of the variables are only declared and initialized and unused otherwise
> 
>       float gen_count = 0.0;
>         int gen_var = 0;
>         char gen_str[20] = "test string";
>         char option = 't';
> 
>         breakpoint();
> 
>         while (1) {
>                 pthread_wait_np ();
>                 rtl_printf("Debug count = %x\n", gen_count++);
>                 if (gen_count > 10.0) {
>                         gen_var = 1;
>                 }
>         }
>         return 0;
> }
> 
> int init_module(void) {
> 
>         int i;
>         struct sched_param p = { 0 };
>         pthread_attr_t attr;
> 
> 
>         pthread_attr_init(&attr);
>         p . sched_priority = 1;
>         pthread_attr_setschedparam (&attr,&p);
> 
>         i = pthread_create (&thread, &attr, start_routine, (void *)1);
> 
>         pthread_make_periodic_np (thread, gethrtime(), 500000000);
> 
>         return (i);
> 
> }
> 
> void cleanup_module(void) {
>         pthread_delete_np (thread);
> }
> 
> 
>****************************************************************************************************************
> 
>****************************************************************************************************************/


 
> [root@Prithvi hello]# make clean; make
> rm -f *.o
> kgcc -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing 
>-fno-common -pipe -march=i586 -DMODULE -g -D__RTL__ -D_LOOSE_KERNEL_NAMES -O2 
>-I/usr/src/rtlinux-3.1/linux/include -I/usr/src/rtlinux-3.1/include 
>-I/usr/src/rtlinux-3.1/include/compat -I/usr/src/rtlinux-3.1/include/posix   -c -o 
>hello.o hello.c
> hello.c: In function `start_routine':
> hello.c:13: warning: unused variable `option'
> hello.c:12: warning: unused variable `gen_str'
> [root@Prithvi hello]# rtlinux start
> Warning: loading /usr/rtlinux-3.1/modules/mbuff.o will taint the kernel: no license
> Warning: loading /usr/rtlinux-3.1/modules/rtl.o will taint the kernel: no license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_time.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_posixio.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_fifo.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_sched.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_debug.o will taint the kernel: no 
>license
> 
> Scheme: (-) not loaded, (+) loaded
>   (+) mbuff
>   (+) rtl_debug
>   (+) rtl_fifo
>   (+) rtl
>   (+) rtl_posixio
>   (+) rtl_sched
>   (+) rtl_time
> 
> 
> [root@Prithvi hello]# insmod hello.o
> Warning: loading hello.o will taint the kernel: no license
> 
> [root@Prithvi hello]# dmesg -c
> mbuff: kernel shared memory driver v0.7.2 for Linux 2.4.18-rtl31
> mbuff: (C) Tomasz Motylewski et al., GPL
> mbuff: registered as MISC device minor 254
> RTLinux Extensions Loaded (http://www.fsmlabs.com/)
> RTLinux Debugger Loaded (http://www.fsmlabs.com/)
> rtl_debug: exception 0x3 in hello (EIP=0xc88570a0), thread id 0xc2358000; (re)start 
>GDB to debug
> 
> [root@Prithvi hello]# gdb hello.o
> 
> GNU gdb Red Hat Linux (5.1.90CVS-5)
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-redhat-linux"...
> 
> (gdb) dbg
> [New Thread -1036681216]
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> [Switching to Thread -1036681216]
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> 0xc88570a0 in start_routine () at hello.c:15
> 15              breakpoint();
> warning: shared library handler failed to enable breakpoint
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> (gdb) info locals
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> No symbol table info available.
> warning: (Internal error: pc 0xc88570a0 in read in psymtab, but not in symtab.)
> 
> (gdb) quit
> The program is running.  Exit anyway? (y or n) y

I downgraded to gdb-4.18-11 and this is the output

> [root@Prithvi hello]# rtlinux start
> 
> Warning: loading /usr/rtlinux-3.1/modules/mbuff.o will taint the kernel: no license
> Warning: loading /usr/rtlinux-3.1/modules/rtl.o will taint the kernel: no license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_time.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_posixio.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_fifo.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_sched.o will taint the kernel: no 
>license
> Warning: loading /usr/rtlinux-3.1/modules/rtl_debug.o will taint the kernel: no 
>license
> 
> Scheme: (-) not loaded, (+) loaded
>   (+) mbuff
>   (+) rtl_debug
>   (+) rtl_fifo
>   (+) rtl
>   (+) rtl_posixio
>   (+) rtl_sched
>   (+) rtl_time
> 
> 
> [root@Prithvi hello]# insmod hello.o
> 
> Warning: loading hello.o will taint the kernel: no license
> 
> [root@Prithvi hello]# dmesg -c
> 
> mbuff: kernel shared memory driver v0.7.2 for Linux 2.4.18-rtl31
> mbuff: (C) Tomasz Motylewski et al., GPL
> mbuff: registered as MISC device minor 254
> RTLinux Extensions Loaded (http://www.fsmlabs.com/)
> RTLinux Debugger Loaded (http://www.fsmlabs.com/)
> rtl_debug: exception 0x3 in hello (EIP=0xc88570a0), thread id 0xc50f0000; (re)start 
>GDB to debug
> 
> [root@Prithvi hello]# gdb hello.o
> 
> GNU gdb 19991004
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-redhat-linux"...
> 
> (gdb) dbg
> [New Pid -988872704]
> [Switching to Pid -988872704]
> 0xc88570a0 in start_routine (arg=0x1) at hello.c:15
> 15              breakpoint();
> 
> (gdb) info locals
> gen_count = 0
> gen_str =   "test string"
> 

The warnings about the internal error and the failure of the shared
library handler to enable the breakpoint have disappeared, but the local
variables in the function *start_routine have not been recognized and
read in. They are however read in if all of them are declared static. In
the latter case, a 

> (gdb) print option

statement provides the output

> $1 = 116 't'

1. What do the warning messages in gdb-5.1.90CVS-5 mean ?
2. Why are all the symbols not read in completely in gdb-4.18-11 ?
3. Why are all the symbols visible *when declared static* ?
4. What does the 116 in the output of "print option" stand for ?

An earlier mail in the archives does mention that the later versions of
gdb (>5.0) have a bug but that the debugger seems to work fine with
gdb-4.18 . I am unable to figure out at what point the problem could be.
The situation is exactly the same on the same machine with rtl2.3, linux
2.2.14 and RedHat6.2, with gdb-4.18-11

Any help would be greatly appreciated.

Thanx

VC
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to