You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by "tonychen0924 (via GitHub)" <gi...@apache.org> on 2023/12/29 07:58:40 UTC
[I] How to debug bundles with GDB (celix)
tonychen0924 opened a new issue, #706:
URL: https://github.com/apache/celix/issues/706
When I build my process , CMakeLists.txt also add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
But when I run exe with gdb and set break , can not find my source file .
Does the bundle not support GDB debugging or does it require specific settings ?
r$ gdb ./MyContainer
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./MyContainer...
(gdb) b plc_main.c:8
No source file named plc_main.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (plc_main.c:8) pending.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "tonychen0924 (via GitHub)" <gi...@apache.org>.
tonychen0924 commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871873739
But I tested why it's not very stable, and only once has it successfully hit the breakpoint ?Is there a problem with the environment in WSL2? Under wsl1, even my tests did not support gdb debugging functionality .
https://github.com/tonychen0924/CelixTest/tree/main/unitDemo
tony@LAPTOP-4AFLJE2J:~/git_pro/CelixTest/unitDemo/build/deploy/MyContainer$ gdb ./MyContainer
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./MyContainer...
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 6427)]
[New Thread 0x7ffff6141640 (LWP 6428)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 6429)]
create instance address:0x5555555a7a40
create CtrlConsumerBundle bundle, consumer address:0x5555555a7a40
StartPLC localPCtrl address:0
WARNING: StartPLC Calc service not available!
StopPLC localPCtrl address:0
WARNING: Calc service not available!
setCtrlthis address:0x5555555a7a40 pCtrl address:0x5555555a6720
[2023-12-29T16:28:14] [ info] [celix_framework] [framework_start:492] Celix framework started
StartPLC localPCtrl address:0x5555555a6720
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a6720
stopPLC
StartPLC localPCtrl address:0x5555555a6720
startPLC
1====================
2====================
3====================
-> quit
Quitting framework
[New Thread 0x7ffff50cf640 (LWP 6442)]
-> setCtrlthis address:0x5555555a7a40 pCtrl address:0
[Thread 0x7ffff58d0640 (LWP 6429) exited]
[Thread 0x7ffff6141640 (LWP 6428) exited]
[Thread 0x7ffff50cf640 (LWP 6442) exited]
[Thread 0x7ffff69d3640 (LWP 6427) exited]
[Inferior 1 (process 6424) exited normally]
(gdb) b CtrlConsumer.h:41
Breakpoint 1 at 0x7ffff58dc3c4: file /home/tony/git_pro/CelixTest/unitDemo/rte/include/CtrlConsumer.h, line 41.
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 6514)]
[New Thread 0x7ffff6141640 (LWP 6517)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 6518)]
create instance address:0x5555555a8740
create CtrlConsumerBundle bundle, consumer address:0x5555555a8740
setCtrlthis address:0x5555555a8740 pCtrl address:0x5555555a7420
[2023-12-29T16:29:02] [ info] [celix_framework] [framework_start:492] Celix framework started
[Switching to Thread 0x7ffff58d0640 (LWP 6518)]
Thread 4 "MyContainer" hit Breakpoint 1, CtrlConsumer::run (this=0x5555555a8740) at /home/tony/git_pro/CelixTest/unitDemo/rte/include/CtrlConsumer.h:41
41 StartPLC();
(gdb) next
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
42 StopPLC();
(gdb)
StopPLC localPCtrl address:0x5555555a7420
stopPLC
43 sleep(1);
(gdb)
tony@LAPTOP-4AFLJE2J:~/git_pro/CelixTest/unitDemo/build/deploy/MyContainer$ gdb ./MyContainer
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./MyContainer...
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 7853)]
[New Thread 0x7ffff6141640 (LWP 7854)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 7855)]
StartPLC localPCtrl address:create instance address:00x5555555a8740
WARNING: StartPLC Calc service not available!
StopPLC localPCtrl address:0
WARNING: Calc service not available!
create CtrlConsumerBundle bundle, consumer address:0x5555555a8740
setCtrlthis address:0x5555555a8740 pCtrl address:0x5555555a7420
[2023-12-29T16:42:17] [ info] [celix_framework] [framework_start:492] Celix framework started
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> qStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> bStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b CtStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b CtrlStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b CtrlImStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b CtrlImpStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> b CtrlIStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quitStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quit
Quitting framework
[New Thread 0x7ffff50cf640 (LWP 7883)]
-> setCtrlthis address:0x5555555a8740 pCtrl address:0
[Thread 0x7ffff58d0640 (LWP 7855) exited]
[Thread 0x7ffff6141640 (LWP 7854) exited]
[Thread 0x7ffff50cf640 (LWP 7883) exited]
[Thread 0x7ffff69d3640 (LWP 7853) exited]
[Inferior 1 (process 7850) exited normally]
(gdb) b Ctrl
ACEPHERE_RUNTIME::CtrlImpl::CtrlImpl(int)
ACEPHERE_RUNTIME::CtrlImpl::StartPLC()
ACEPHERE_RUNTIME::CtrlImpl::StopPLC()
ACEPHERE_RUNTIME::CtrlImpl::calc(int)
ACEPHERE_RUNTIME::CtrlImpl::~CtrlImpl()
CtrlConsumer*& std::__get_helper<1ul, CtrlConsumer*>(std::_Tuple_impl<1ul, CtrlConsumer*>&)
CtrlConsumer*&& std::forward<CtrlConsumer*>(std::remove_reference<CtrlConsumer*>::type&)
CtrlConsumer.h
CtrlConsumer::CtrlConsumer()
CtrlConsumer::StartPLC()
CtrlConsumer::StopPLC()
CtrlConsumer::create()
CtrlConsumer::create()::{lambda(CtrlConsumer*)#1}* std::__addressof<CtrlConsumer::create()::{lambda(CtrlConsumer*)#1}>(CtrlConsumer::create()::{lambda(CtrlConsumer*)#1}&)
CtrlConsumer::create()::{lambda(CtrlConsumer*)#1}::operator()(CtrlConsumer*) const
CtrlConsumer::run()
CtrlConsumer::setCtrl(std::shared_ptr<ACEPHERE_RUNTIME::ICtrl>)
CtrlConsumer::start()
CtrlConsumer::stop()
CtrlConsumer::~CtrlConsumer()
CtrlConsumerBundle*& std::__get_helper<0ul, CtrlConsumerBundle*, std::default_delete<CtrlConsumerBundle> >(std::_Tuple_impl<0ul, CtrlConsumerBundle*, std::default_delete<CtrlConsumerBundle> >&)
CtrlConsumerBundle.cpp
CtrlConsumerBundle::CtrlConsumerBundle(std::shared_ptr<celix::BundleContext> const&)
CtrlConsumerBundle::createTracker(std::shared_ptr<celix::BundleContext> const&)
CtrlConsumerBundle::~CtrlConsumerBundle()
CtrlImpl.h
(gdb) b CtrlImpl.h:42
No line 42 in file "CtrlImpl.h".
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (CtrlImpl.h:42) pending.
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 7927)]
[New Thread 0x7ffff6141640 (LWP 7928)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 7929)]
StartPLC localPCtrl address:0
WARNING: StartPLC Calc service not available!
StopPLC localPCtrl address:0
WARNING: Calc service not available!
create instance address:0x5555555a8740
create CtrlConsumerBundle bundle, consumer address:0x5555555a8740
setCtrlthis address:0x5555555a8740 pCtrl address:0x5555555a7420
[2023-12-29T16:43:02] [ info] [celix_framework] [framework_start:492] Celix framework started
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quitStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quit
Quitting framework
[New Thread 0x7ffff50cf640 (LWP 7933)]
-> setCtrlthis address:0x5555555a8740 pCtrl address:0
[Thread 0x7ffff58d0640 (LWP 7929) exited]
[Thread 0x7ffff6141640 (LWP 7928) exited]
[Thread 0x7ffff50cf640 (LWP 7933) exited]
[Thread 0x7ffff69d3640 (LWP 7927) exited]
[Inferior 1 (process 7926) exited normally]
(gdb) b CtrlImpl.h:42
No line 42 in file "CtrlImpl.h".
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (CtrlImpl.h:42) pending.
(gdb) next
The program is not being run.
(gdb) continue
The program is not being run.
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 7989)]
[New Thread 0x7ffff6141640 (LWP 7990)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 7991)]
StartPLC localPCtrl address:create instance address:0x5555555a87400
WARNING: StartPLC Calc service not available!
StopPLC localPCtrl address:0
WARNING: Calc service not available!
create CtrlConsumerBundle bundle, consumer address:0x5555555a8740
setCtrlthis address:0x5555555a8740 pCtrl address:0x5555555a7420
[2023-12-29T16:43:42] [ info] [celix_framework] [framework_start:492] Celix framework started
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> coStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> conStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> continueStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> continue
No command 'continue'. Provided command line: continue
-> StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quit
Quitting framework
[New Thread 0x7ffff50cf640 (LWP 8019)]
-> setCtrlthis address:0x5555555a8740 pCtrl address:0
[Thread 0x7ffff58d0640 (LWP 7991) exited]
[Thread 0x7ffff6141640 (LWP 7990) exited]
[Thread 0x7ffff69d3640 (LWP 7989) exited]
[Thread 0x7ffff50cf640 (LWP 8019) exited]
[Inferior 1 (process 7988) exited normally]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "tonychen0924 (via GitHub)" <gi...@apache.org>.
tonychen0924 commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871880693
My test case link:
https://github.com/tonychen0924/CelixTest/tree/main/unitDemo
"CtrlConsumer.h" can find and set break point successfully , but "plc_main.c" can not ?
tony@LAPTOP-4AFLJE2J:~/git_pro/CelixTest/unitDemo/build/deploy/MyContainer$
gdb ./MyContainer
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./MyContainer...
(gdb) run
Starting program: /home/tony/git_pro/CelixTest/unitDemo/build/deploy/MyContainer/MyContainer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff69d3640 (LWP 10321)]
[New Thread 0x7ffff6141640 (LWP 10322)]
-> 注册plc service bundle
启动plc service bundle
[New Thread 0x7ffff58d0640 (LWP 10323)]
create instance address:0x5555555a8740
create CtrlConsumerBundle bundle, consumer address:0x5555555a8740
StartPLC localPCtrl address:0
WARNING: StartPLC Calc service not available!
StopPLC localPCtrl address:0
WARNING: Calc service not available!
setCtrlthis address:0x5555555a8740 pCtrl address:0x5555555a7420
[2023-12-29T17:04:30] [ info] [celix_framework] [framework_start:492] Celix framework started
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> lb
Bundles:
ID State Name Group
0 ACTIVE Celix Framework Celix/Framework
1 ACTIVE Apache Celix CXX Shell Celix/Shell
2 ACTIVE Apache Celix Shell TUI Celix/Shell
3 ACTIVE PlcCtrlBundle
4 ACTIVE RteBundle
-> StartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quitStartPLC localPCtrl address:0x5555555a7420
startPLC
1====================
2====================
3====================
StopPLC localPCtrl address:0x5555555a7420
stopPLC
-> quit
Quitting framework
[New Thread 0x7ffff50cf640 (LWP 10330)]
-> setCtrlthis address:0x5555555a8740 pCtrl address:0
[Thread 0x7ffff58d0640 (LWP 10323) exited]
[Thread 0x7ffff6141640 (LWP 10322) exited]
[Thread 0x7ffff50cf640 (LWP 10330) exited]
[Thread 0x7ffff69d3640 (LWP 10321) exited]
[Inferior 1 (process 10315) exited normally]
(gdb) b CtrlConsumer.h:41
Breakpoint 1 at 0x7ffff58dc3c4: file /home/tony/git_pro/CelixTest/unitDemo/rte/include/CtrlConsumer.h, line 41.
(gdb) b plc_main.c:8
No source file named plc_main.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (plc_main.c:8) pending.
(gdb)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871951932
`set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")`
You only add `-g` to C++ not to C.
If you follow my advice earlier using `-DCMAKE_BUILD_TYPE:STRING=Debug`, then all C and C++ will have -g.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871884831
> "CtrlConsumer.h" can find and set break point successfully , but "plc_main.c" can not ?
Of course you can't. I saw no usage of `plc_main.h` in the bundle.
```C++
//Ctrl bundle服务提供者和使用者
#include "celix/BundleActivator.h"
#include "CtrlImpl.h"
extern "C"
{
#include "plc_main.h"
}
class PlcCtrlBundle
{
public:
//构造函数,初始化成员变量registration
explicit PlcCtrlBundle(std::shared_ptr<celix::BundleContext> ctx) :
registration{createPlcService(ctx)}
{
std::cout << "启动plc service bundle" << std::endl;
}
private:
static std::shared_ptr<celix::ServiceRegistration> createPlcService(std::shared_ptr<celix::BundleContext>& ctx)
{
//绑定,赋值
int seed = 42;
std::cout << "注册plc service bundle" << std::endl;
//注册服务
return ctx->registerService<ACEPHERE_RUNTIME::ICtrl>(std::make_shared<ACEPHERE_RUNTIME::CtrlImpl>(seed))
.addProperty("seed", seed)
.build();
}
//作为服务端
const std::shared_ptr<celix::ServiceRegistration> registration;
};
CELIX_GEN_CXX_BUNDLE_ACTIVATOR(PlcCtrlBundle)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871840909
> (gdb) b plc_main.c:8
> No source file named plc_main.c.
You forget to run your program. If your program has not loaded a bundle(or any other shared library) by `dlopen`, how could it be able to get the debugging information embedded in an shared library and thus get to know the location of the associated source file?
Please take some time to read the first chapter of Debugging with GDB.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871934379
Try setting break point and then step into `startPLC`: https://github.com/tonychen0924/CelixTest/blob/2fcf5967e567bef2cf05f66856aa3f02f2d16ba6/unitDemo/implement/CtrlImpl.h#L31C8-L31C8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng closed issue #706: How to debug bundles with GDB
URL: https://github.com/apache/celix/issues/706
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871849357
I changed my mind and thought about it from a different angle, that the problem might not be completely unrelated to Celix.
A first-time user may indeed set a breakpoint and be surprised to find that the breakpoint is not hit. It might be helpful to beginners if there was a mention in the documentation of how to set up breakpoints for a bundle.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "tonychen0924 (via GitHub)" <gi...@apache.org>.
tonychen0924 commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1873105850
I mistakenly thought that just adding C++was enough . Because only the C++compilation options were set during compilation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871828571
Add `-DCMAKE_BUILD_TYPE:STRING=Debug` to your CMake command line, then CMake should take care of everything.
This seems not Celix-related but a general CMake question, which may better be raises on some sites like Stackoverflow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "tonychen0924 (via GitHub)" <gi...@apache.org>.
tonychen0924 commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871920190
But I don't think it has anything to do with debugger plc_main.c . startPLC of plc_mian.c has been call and print in terminal , but also prompt:
`void startPLC(int a, int b)
{
printf("%s\n", __func__);
printf("1====================\n");
printf("2====================\n");
printf("3====================\n");
}`
(gdb) b plc_main.c:8
No source file named plc_main.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (plc_main.c:8) pending.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "tonychen0924 (via GitHub)" <gi...@apache.org>.
tonychen0924 commented on issue #706:
URL: https://github.com/apache/celix/issues/706#issuecomment-1871821915
“b <function>” also can not find
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to debug bundles with GDB (celix)
Posted by "PengZheng (via GitHub)" <gi...@apache.org>.
PengZheng closed issue #706: How to debug bundles with GDB
URL: https://github.com/apache/celix/issues/706
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org