Vinay Kumar | 22 Jul 2011 08:33
Favicon

Watch point issue across multiple threads

Hi All,

I have set a watch-point to monitor the contents changing in global data address. The data in this global address is accessed & modified by 3 threads.

(gdb)watch *(int *) 0xb75dafd8

But now I get the following warning each time a thread is started or when a thread stops:

warning:  Could not remove hardware watchpoint 2

Please let me know the reason why watch-point get affected by thread exit. However I do not want the watch-point to be removed. What do I have to do such
that gdb does not try to remove the watch-point & watch-point can be used by multiple threads? Please guide me.

Thanks & Best Regards,
Vinay
andy_westken | 25 Jul 2011 19:47
Picon
Favicon

Setting a breakpoint at a line number and character offset


Hi

I apologise if this question has been answered elsewhere, but my web
searches were swamped by noise... 

Is is possible to get gdb to set a breakpoint at a line number and a
character offset (or column) on the line?

From what I understand, this is not possible (at least for Ubuntu and
GnuWin32 versions of the debugger). But I wanted to cross-check before using
this to justify an item in some coding conventions.

Thanks, Andy

P.S. My contention is that code of the following form is intrinsically evil,
from a debugging perspective.

if(condition) function1() else function2();

whereas

if(condition)
    function1()
else
    function2();

is debuggable!
--

-- 
View this message in context: http://old.nabble.com/Setting-a-breakpoint-at-a-line-number-and-character-offset-tp32133893p32133893.html
Sent from the Gnu - gdb - General mailing list archive at Nabble.com.

Charles Manning | 28 Jul 2011 00:10
Picon

Re: Setting a breakpoint at a line number and character offset

On Tuesday 26 July 2011 05:47:15 andy_westken wrote:
> Hi
>
> I apologise if this question has been answered elsewhere, but my web
> searches were swamped by noise...
>
> Is is possible to get gdb to set a breakpoint at a line number and a
> character offset (or column) on the line?

Only a line number AFAIK.

Setting it at an actual column offset would be challenging.

>
> From what I understand, this is not possible (at least for Ubuntu and
> GnuWin32 versions of the debugger). But I wanted to cross-check before
> using this to justify an item in some coding conventions.
>
> Thanks, Andy
>
> P.S. My contention is that code of the following form is intrinsically
> evil, from a debugging perspective.

Some might argue the corollary that debugging is evil from a coding 
perspective :-).
>
> if(condition) function1() else function2();

I guess you could do something like:

break function1
condition 1 (condition)

>
> whereas
>
> if(condition)
>     function1()
> else
>     function2();
>
> is debuggable!


Gmane