trigger LLDB breakpoint?

Discussion about CodeLite development process and patches
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

trigger LLDB breakpoint?

Post by petah »

Hi Eran,

I'd like to break to LLDB when my code throws an exception, is there a way to automatically do that like with GDB? if not is there a signal or exception I can call from my code to do so? I already have exception handlers in place so the latter would be just fine.

I realize GDB is more mature than LLDB but I'm occasionally testing libc++ on Linux (with libcxxrt).

thx a lot & cheers,

-- p
main: Debian Jessie x64 + custom wxTrunk
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: trigger LLDB breakpoint?

Post by eranif »

Have you tried adding this to your code:

Code: Select all

raise(SIGTRAP)
Eran
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: trigger LLDB breakpoint?

Post by petah »

it works with libstdc++ (clang and gcc) but with libc++/LLDB it freezes silently with CL's UI looking like it was about to enter the debugger. I tried both in wxApp::OnInit() and on a menu event later.

How can I ensure that CL's codelite-lldb gets called? I added the direct path to the project's settings, under debugger path, but it's still picking up mine over yours, i.e. I have a "locals" window title instead of "locals & watches" as I see in CL's source.

thx!

-- p
main: Debian Jessie x64 + custom wxTrunk
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: trigger LLDB breakpoint?

Post by eranif »

petah wrote:I have a "locals" window title instead of "locals & watches" as I see in CL's source.
This is because you still have the old perspectives kept (wx keeps the frame title in it...)
petah wrote:it works with libstdc++ (clang and gcc) but with libc++/LLDB it freezes silently with CL's UI looking like it was about to enter the debugger. I tried both in wxApp::OnInit() and on a menu event later
I will need to debug this

Eran
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: trigger LLDB breakpoint?

Post by petah »

ok it's possible that my libc6 has a problem but to exclude wx, I just tried this minimal sample

Code: Select all

#include <string>
#include <cassert>
#include <iostream>
#include <regex>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <stdexcept>
#include <csignal>

using namespace std;
using namespace chrono;

int main()
{
	string	s = "vanilla\n ";
	
	regex	re("[0-9]+");
	
	bool	f = regex_match("12300", re);
	
	cerr << s << (f ? "std::regex match" : "nope on regex") << endl << flush;
	
	const auto	ms = duration_cast<milliseconds>(high_resolution_clock::now().time_since_epoch()).count();
	
	const double	ms_d = ms;
	
	cerr << "chrono: elapsed ms " << ms_d << " since epoch" << endl;
	
	unordered_set<string>	test_set = {"un", "deux", "cinq"};
	bool	f1 = (test_set.count("deux") > 0);
	bool	not_f2 = (test_set.count("truete") > 0);
	
	cerr << "hashset: entry " << (f1 ? "ok" : "FAIL") << "... not entry: "<< (not_f2 ? "FAIL" : "ok") << "... (rastaman done)" << endl;
	
	unordered_map<string, int>	test_map = {{"trois", 3}, {"neuf", 9}};

	cerr << "hashmap: entries " << (test_map["trois"]) << "... " << (test_map["neuf"]) << endl;
		
	try
	{
		cerr << "crasher " << (test_map["boum"])  << endl;
		
		throw("whaaaa");
	}
	catch (...)
	{
		cerr << "caught crasher" << endl;
	}
	
	raise(SIGTRAP);
	
	return 1;
}
compiling with clang & libc++. when launched from CL it freeze, but from cmd line it gives:
./cxxtest64d.bin
vanilla
std::regex match
chrono: elapsed ms 7.70964e+07 since epoch
hashset: entry ok... not entry: ok... (rastaman done)
hashmap: entries 3... 9
crasher 0
caught crasher
Trace/breakpoint trap
thx again
You do not have the required permissions to view the files attached to this post.
main: Debian Jessie x64 + custom wxTrunk
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: trigger LLDB breakpoint?

Post by petah »

eranif wrote:
petah wrote:I have a "locals" window title instead of "locals & watches" as I see in CL's source.
This is because you still have the old perspectives kept (wx keeps the frame title in it...)
ok I flushed the perspectives and can now see code changes in CL's UI :D

building libc++ on linux is ~ guesswork bc the clang page has 3 different ABIs; cxxrt works for me but dunno if there's a better way. I can send my receipe if you want.

thx,

-- p
You do not have the required permissions to view the files attached to this post.
main: Debian Jessie x64 + custom wxTrunk
Post Reply