info sharedlibrary command

info sharedlibrary command

Shows information about the loaded libraries, their addresses and state of the debugging symbols.

Syntax
info sharedlibrary
info share

Remarks

The info sharedlibrary command is only valid when the debugged application has already started.

If the info sharedlibrary command reveals that some of the symbols for the currently loaded libraries are not loaded, you can load them manually using the sharedlibrary command.

Examples

This example shows a sample output of the info sharedlibrary command:

(gdb) info sharedlibrary
No shared libraries loaded at this time.
(gdb) start

Temporary breakpoint 1 at 0x80484ed: file main.cpp, line 7.
Starting program: /home/testuser/libtest/testApp
Temporary breakpoint 1, main () at main.cpp:7
7 printf("In main()\n");
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0xb7fde820 0xb7ff6b9f Yes /lib/ld-linux.so.2
0xb7fd83a0 0xb7fd84c8 Yes /home/testuser/libtest/libTest.so
0xb7e30f10 0xb7f655cc Yes /lib/i386-linux-gnu/libc.so.6
Compatibility with VisualGDB

You can view the information about the shared libraries loaded into your Linux, Android or Windows application using the normal Modules window in Visual Studio. Alternatively you can always issue the info sharedlibrary command using the GDB Session window.

See also

Shared library commands,set auto-solib-add,set solib-search-path,set stop-on-solib-events,set sysroot,sharedlibrary

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
To link a C++ shared library, you need to follow these steps: 1. Compile your C++ code into an object file using the `-c` flag. For example, if your C++ code is in a file called `mylibrary.cpp`, you would run the following command: `g++ -c -fPIC mylibrary.cpp` The `-fPIC` flag is necessary to generate Position Independent Code, which is needed for shared libraries. 2. Link the object file into a shared library using the `-shared` flag. For example, if your object file is called `mylibrary.o`, you would run the following command: `g++ -shared -o libmylibrary.so mylibrary.o` The `-o` flag specifies the output file name, and the `.so` extension is used for shared libraries on Linux. 3. Include the shared library in your project by specifying the library name and location in your build system. For example, if you are using CMake, you would add the following lines to your `CMakeLists.txt` file: ``` add_library(mylibrary SHARED IMPORTED) set_target_properties(mylibrary PROPERTIES IMPORTED_LOCATION /path/to/libmylibrary.so) ``` This tells CMake to import the `mylibrary` shared library and set its location to `/path/to/libmylibrary.so`. 4. Use the functions and classes defined in the shared library in your code by including the appropriate header files and linking against the library. For example, if your library defines a function called `myfunction`, you would include its header file and link against the library like this: ``` #include "mylibrary.h" ... myfunction(); ``` And in your build system, you would specify the library as a dependency: ``` target_link_libraries(myprogram mylibrary) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值