Angus Leeming <[EMAIL PROTECTED]> writes:

> 
> Andreas Vox wrote:
> > For me it's more a kind of bug aid  It's like having lots of
> > "Quit without saving" buttons in the document.
> 
> Nonsense. lyxbreaker calls BOOST_ASSERT which calls 
> assertion_failed (src/boost.C) which calls emergencyCleanup 
> which saves your data.

Make that "Quit with emergency save" then, :-)

> Which means that it's dead easy to set a break point in gdb. 

I still need some advice how to start LyX under gdb on MacOS 
with console attached *and* the window being able to get focus.

...
> Try it yourself:

Ok, let's try.

> gdb ./lyx

$ gdb /Applications/LyX.app/Contents/MacOS/lyx

BTW: is your unstripped binary also 200 MB ? 
Takes some time to load into gdb!

> (gdb) break lyxbreaker
> Breakpoint 1 at 0x120132a34: file ostream, line 193.
> (gdb) run

(gdb) break lyxbreaker
Breakpoint 1 at 0x461f4: file /usr/include/gcc/darwin/3.3/c++
          /ostream, line 173.
(gdb) run ~/tmp/newfile-times.lyx
Starting program: /Applications/LyX.app/Contents/MacOS/lyx ~/tmp/
          newfile-times.lyx
Reading symbols for shared libraries ...............
          .... done
BufferView::Pimpl::update(fc=0, fu=1)  buffer: 0

Ok, I ignore the emergence file and load the original...
The file has maths at the beginning and shows preview...
I click on a preview...
(Fortunately I don't need any focus for this, just two mouseclicks)


Breakpoint 1, lyxbreaker(void const*, char const*, int) (data=
          0xd92f1e0, hint=0xd92f1e0 "\r\222?
[EMAIL PROTECTED]@", size=6022736) at /usr/include/gcc/darwin/3.3
          /c++/ostream:173
173           { 

> Make it crash and now type
> (gdb) where

(gdb) where
#0  lyxbreaker(void const*, char const*, int) (data=0xd92f1e0, hint=
          0xd92f1e0 "\r\222?0\r\222?
@\r\222?@", size=6022736) at /usr/include/gcc/darwin/3.3/c++/
          ostream:173
#1  0x00115778 in MathArray::xo() const (this=0xd92f1e0) at /usr/
          include/gcc/darwin/3.3/c++/bits/
stl_map.h:300
#2  0x00115500 in MathArray::dist(int, int) const (this=0xd92f1e0, 
          x=227733984, y=51) at 
math_data.C:394
#3  0x001e8b44 in MathNestInset::editXY(LCursor&, int, int) const 
          (this=0x113470c0, 
[EMAIL PROTECTED], x=143, y=51) at math_nestinset.C:932
#4  0x000c4330 in LyXText::editXY(LCursor&, int, int) const (this=
          0xf4240, [EMAIL PROTECTED], x=
-1073749056, y=143) at text2.C:1196
#5  0x0000a5a0 in BufferView::Pimpl::workAreaDispatch(FuncRequest 
          const&) (this=0xc34be70, 
[EMAIL PROTECTED]) at BufferView_pimpl.C:894
#6  0x00625ec0 in boost::detail::function::void_function_obj_invoker1
          <boost::_bi::bind_t<bool, boost::
_mfi::mf1<bool, BufferView::Pimpl, FuncRequest const&>, boost::_bi
          ::list2<boost::_bi::
value<BufferView::Pimpl*>, boost::arg<1> > >, void, FuncRequest>
          ::invoke(boost::detail::function::
any_pointer, FuncRequest) (function_obj_ptr={obj_ptr = 0x5be650,
           const_obj_ptr = 0x5be650, 
func_ptr = 0x5be650 <typeinfo name for long long>, data = ""}, 
          a0=Cannot access memory at address 
0x0
) at ../boost/boost/bind/mem_fn_template.hpp:148
#7  0x006b51d4 in boost::function1<void, FuncRequest, std::allocator
          <void> >::
operator()(FuncRequest) const (this=0x7da340, a0={action = 209704280, 
          argument = {static npos = 
4294967295, _M_dataplus = {<allocator<char>> = {<No data fields>},
          _M_p = 0xc7fd570 "\f\177?0"}, 
static _S_empty_rep_storage = {0, 0, 3086, 0}}, origin = 209704304,
          x = 0, y = 204782304, button_ = 
none}) at QWorkArea.C:164
#8  0x006b4e5c in 
_ZN5boostppINS_7signals6detail18slot_call_iteratorINS2_11call_bou
          nd1IvE6callerI11FuncRequestNS_8f
unctionIFvS7_ESaIvEEEEENS2_23named_slot_map_iteratorEEENS2_8unusa
          bleENS_25single_pass_traversa
l_tagERKSF_iEENS_6detail24postfix_increment_resultIT_T0_T2_T1_E4ty
          peERNS_15iterator_facadeISL_SM
_SO_SN_T3_EEi ([EMAIL PROTECTED]) at QWorkArea.C:164
#9  0x006b4a70 in 
_ZN5boost7signal1Iv11FuncRequestNS_10last_valueIvEEiSt4lessIiENS_8fun
          ctionIFvS1_ESaIvEEEEclES1_ 
(this=0x33, a1={action = 288398160, argument = {static npos = 
          4294967295, _M_dataplus = 
{<allocator<char>> = {<No data fields>}, _M_p = 0xc328190 "\0219?["}, 
          static _S_empty_rep_storage 
= {0, 0, 3086, 0}}, origin = UI, x = -1877392896, y = 204636880, 
           button_= 2952953856}) at ../../../
boost/boost/iterator/iterator_facade.hpp:152
#10 0x0034ef58 in QContentPane::mousePressEvent(QMouseEvent*)
           (this=0xc34c760, e=0xbfffe8f0) 
at QContentPane.C:117

> (gdb) backtrace

That's the same as where,  no?


Let's look:

#2  0x00115500 in MathArray::dist(int, int) const (this=0xd92f1e0, 
          x=227733984, y=51) at 
math_data.C:394

The value for x looks kind of exaggerated. 
Ok, I'll poke around in the code for a while.

But I still don't know how to debug errors triggered by key events 
(since on MacOS they all go to the console)

Cheers
/Andreas

Reply via email to