This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB hardware watchpoint information on i386


Hi,
If you look at functions 
'bpstat_stop_status' and 'bpstat_do_actions', they find out why the process was 
stooped and how to execute the associated command.
Regards,
Oza.



----- Original Message ----
From: Shrikanth Kamath <shrikanth07@gmail.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb@sourceware.org
Sent: Mon, August 2, 2010 1:25:02 PM
Subject: Re: GDB hardware watchpoint information on i386

Decent enough Jan. Okay, from internals perspective, say I have
written the "commands" to be executed when the watchpoint is hit,
which function
inside GDB maps this action(s) to the watchpoint trap?

I mean there would be
foo_service_watchpoint()
{
   /* map actions to this watchpoint */
}

which is this function?

--
Shrikanth R K

On Mon, Aug 2, 2010 at 12:28 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Mon, 02 Aug 2010 06:10:31 +0200, Shrikanth Kamath wrote:
>> I am specifically looking for information about "hooking" my own handler to
>> service the watchpoint interrupt rather than needing to invoke a GDB session
>> and press 'c'.
>
> Besides GDB hacking isn't it enough for you to use `commands' with `continue'
> and associate arbitrary commands (`backtrace' here) in the GDB CLI interface?
>
> Regards,
> Jan
>
>
> (gdb) watch v
> Hardware watchpoint 1: v
> (gdb) commands
> Type commands for when breakpoint 1 is hit, one per line.
> End with a line saying just "end".
>>backtrace
>>continue
>>end
> (gdb) run
> Starting program: var
> Hardware watchpoint 1: v
>
> Old value = 0
> New value = 1
> f () at var.c:7
> 7       }
> #0  f () at var.c:7
> #1  0x00000000004004a7 in main () at var.c:20
> Hardware watchpoint 1: v
>
> Old value = 1
> New value = 0
> g () at var.c:13
> 13      }
> #0  g () at var.c:13
> #1  0x00000000004004ac in main () at var.c:21
> Hardware watchpoint 1: v
>
> Old value = 0
> New value = 1
> f () at var.c:7
> 7       }
> #0  f () at var.c:7
> #1  0x00000000004004a7 in main () at var.c:20
> Hardware watchpoint 1: v
>
> [...]
>



      


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]