Sponsored Content
Top Forums Programming gdb - loading symbols of shared library Post 302245984 by rimon on Sunday 12th of October 2008 07:01:59 AM
Old 10-12-2008
gdb - loading symbols of shared library

I am debugging in gdb a program that dynamically loads libodbcinst.so. I want to debug the code from libodbcinst - I can break in it, see the source and step through it, but whenever I try printing a variable, I get (e.g. for the variable ret):
Code:
No symbol "ret" in current context.

In my program libodbcinst.so loads my own library (an odbc driver). This library I can debug fully, symbols and all.
Things I've verified:
- libodbcinst.so is compiled with debug information. I compiled it myself from UnixODBC sources, and made sure it was compiled with debug info.
- libodcinst.so is not stripped - I ran 'nm' on it, and got a symbol table.
- From gdb I ran 'info share' and saw that libodbcinst.so was in the list of loaded libraries. I also tried running 'sharedlibrary libodbcinst.so' but this made no difference.
- I tried running add-symbol-file for the library. I must admit I have a problem here. This command is supposed to receive an 'address' parameter. The manual says this should be the address where the library was loaded. How do I know that library? I tried putting different things there - for example the address of the text segment I got from 'maint info sections', but not only could I still not see the symbols, this also screwed up something with the rest of the debugging.

So, in addition to a solution to show the symbols, I would also be very grateful for an explanation of the address parameter for add-symbol-file.

I'm working on HP-UX 11.23 (Itanium). Using HP gdb (wdb) 5.7 .

TIA!

RO
 

10 More Discussions You Might Find Interesting

1. Programming

Loading Gdb And Gcc In Unix System

Can any one help me out???? I need to install GDB and GCC in an UNIX machine. can any one point me to any lucid pointer to it. The gNU help on this is proving to be little tangential for me. (2 Replies)
Discussion started by: rraajjiibb
2 Replies

2. Programming

Shared memory in shared library

I need to create a shared library to access an in memory DB. The DB is not huge, but big enough to make it cumbersome to carry around in every single process using the shared library. Luckily, it is pretty static information, so I don't need to worry much about synchronizing the data between... (12 Replies)
Discussion started by: DreamWarrior
12 Replies

3. Programming

Shared memory for shared library

I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability. Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies

4. Red Hat

RHEL5 reboot - error loading shared library

Hi All, I have RHEL 5 installed in my system. Something must has happened because when i reboot the server, it came with many error.. /usr/bin/rhgb-client -- error while loading shared libraries: libpopt.so.0. Can't open shared object files. No such file/directory It finnaly ends with the... (0 Replies)
Discussion started by: c00kie88
0 Replies

5. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

6. Programming

Loading the shared library I want

Hi All I have been given by someone else header file and a shared library to be used by my C++ application. Compilation is fine but when I try to executes the application I receive the following error. ./first: error while loading shared libraries: libMyLib.so.9: cannot open shared object file:... (2 Replies)
Discussion started by: manustone
2 Replies

7. AIX

Loading a shared library in AIX

Hi, I have an application running on AIX. The app is deployed on Webspshere server. Due to some reason, i have to make use of a third party library (Sigar API's) from my application. This library requires an .so file as well. Is there any location where i can put this *.so file and it will... (1 Reply)
Discussion started by: user_guest
1 Replies

8. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies

9. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

10. Programming

Error while loading shared libraries

I am trying to run a C++ program which uses a static library libprun.a. During compilation, I am loading this library file using a environment variable as below. LIBDIR = ${CUSTOM_PATH}/lib LOADLIBS = $(LIBDIR)/libgqlcomm.a \ $(LIBDIR)/libgsml.a \ ... (7 Replies)
Discussion started by: vdivb
7 Replies
ksyms(7D)							      Devices								 ksyms(7D)

NAME
ksyms - kernel symbols SYNOPSIS
/dev/ksyms DESCRIPTION
The file /dev/ksyms is a character special file that allows read-only access to an ELF format image containing two sections: a symbol ta- ble and a corresponding string table. The contents of the symbol table reflect the symbol state of the currently running kernel. You can determine the size of the image with the fstat() system call. The recommended method for accessing the /dev/ksyms file is by using the ELF access library. See elf(3ELF) for details. If you are not familiar with ELF format, see a.out(4). /dev/ksyms is an executable for the processor on which you are accessing it. It contains ELF program headers which describe the text and data segment(s) in kernel memory. Since /dev/ksyms has no text or data, the fields specific to file attributes are initialized to NULL. The remaining fields describe the text or data segment(s) in kernel memory. Symbol table The SYMTAB section contains the symbol table entries present in the currently running kernel. This section is ordered as defined by the ELF definition with locally-defined symbols first, followed by globally-defined symbols. Within symbol type, the symbols are ordered by kernel module load time. For example, the kernel file symbols are first, followed by the first module's symbols, and so on, ending with the symbols from the last module loaded. The section header index (st_shndx) field of each symbol entry in the symbol table is set to SHN_ABS, because any necessary symbol relocations are performed by the kernel link editor at module load time. String table The STRTAB section contains the symbol name strings that the symbol table entries reference. SEE ALSO
kernel(1M), stat(2), elf(3ELF), kvm_open(3KVM), a.out(4), mem(7D) WARNINGS
The kernel is dynamically configured. It loads kernel modules when necessary. Because of this aspect of the system, the symbol information present in the running system can vary from time to time, as kernel modules are loaded and unloaded. When you open the /dev/ksyms file, you have access to an ELF image which represents a snapshot of the state of the kernel symbol informa- tion at that instant in time. While the /dev/ksyms file remains open, kernel module autounloading is disabled, so that you are protected from the possibility of acquiring stale symbol data. Note that new modules can still be loaded, however. If kernel modules are loaded while you have the /dev/ksyms file open, the snapshot held by you will not be updated. In order to have access to the symbol information of the newly loaded modules, you must first close and then reopen the /dev/ksyms file. Be aware that the size of the /dev/ksyms file will have changed. You will need to use the fstat() function (see stat(2)) to determine the new size of the file. Avoid keeping the /dev/ksyms file open for extended periods of time, either by using kvm_open(3KVM) of the default namelist file or with a direct open. There are two reasons why you should not hold /dev/ksyms open. First, the system's ability to dynamically configure itself is partially disabled by the locking down of loaded modules. Second, the snapshot of symbol information held by you will not reflect the sym- bol information of modules loaded after your initial open of /dev/ksyms. Note that the ksyms driver is a loadable module, and that the kernel driver modules are only loaded during an open system call. Thus it is possible to run stat(2) on the /dev/ksyms file without causing the ksyms driver to be loaded. In this case, the file size returned is UNKNOWN_SIZE. A solution for this behavior is to first open the /dev/ksyms file, causing the ksyms driver to be loaded (if necessary). You can then use the file descriptor from this open in a fstat() system call to get the file's size. NOTES
The kernel virtual memory access library (libkvm) routines use /dev/ksyms as the default namelist file. See kvm_open(3KVM) for details. SunOS 5.10 11 Dec 2000 ksyms(7D)
All times are GMT -4. The time now is 05:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy