Re: How do I set a watchpoint?

2015-05-28 Thread Kate Stone
 On May 23, 2015, at 3:15 PM, Jens Alfke j...@mooseyard.com wrote:
 
 On May 23, 2015, at 3:04 PM, Kate Stone katherine_st...@apple.com 
 mailto:katherine_st...@apple.com wrote:
 
 You can evaluate an Objective-C expression in a Swift frame by overriding 
 the default language like so:
 
 Thanks! But it’s a little weird that I’d need to, since “$rax” isn’t ObjC 
 syntax either. That is, I would have thought that the register names are 
 detected as special cases, not as part of language parsing…

LLDB allows identifiers to be defined starting with $, and these are treated 
consistently when parsing the language just like any other identifier.  
Register values can be readily used in C-based languages as if they were 
pointers, but they have far less obvious meaning in a Swift context where 
everything is more strongly typed and is safe by design.

 Should I file a bug on the inability to parse register names in Swift mode?

We’re already tracking suggestions along these lines, but if you have specific 
requests or examples of what you’re trying to accomplish then it never hurts to 
file a bug to provide us as much context as possible.

 I don’t think watchpoints are going to do you much good here because freeing 
 an allocation doesn’t change the allocated memory, just the bookkeeping in 
 malloc’s internal data structures.
 
 It does, when I enable MallocScribble. Could you explain the syntax to set a 
 watchpoint, too? Thanks again…

Per LLDB’s command line help:

(lldb) watchpoint set
The following subcommands are supported:

  expression -- Set a watchpoint on an address by supplying an expression.
Use the '-w' option to specify the type of watchpoint and
the '-x' option to specify the byte size to watch for. If
no '-w' option is specified, it defaults to write. If no
'-x' option is specified, it defaults to the target's
pointer byte size. Note that there are limited hardware
resources for watchpoints. If watchpoint setting fails,
consider disable/delete existing ones to free up
resources.  This command takes 'raw' input (no need to
quote stuff).
  variable   -- Set a watchpoint on a variable. Use the '-w' option to
specify the type of watchpoint and the '-x' option to
specify the byte size to watch for. If no '-w' option is
specified, it defaults to write. If no '-x' option is
specified, it defaults to the variable's byte size. Note
that there are limited hardware resources for watchpoints.
If watchpoint setting fails, consider disable/delete
existing ones to free up resources.

For more help on any particular subcommand, type 'help command subcommand'.

Kate Stone k8st...@apple.com mailto:k8st...@apple.com
 Xcode Runtime Analysis Tools

 ___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How do I set a watchpoint?

2015-05-28 Thread Jens Alfke

 On May 28, 2015, at 4:24 PM, Kate Stone katherine_st...@apple.com wrote:
 
 Register values can be readily used in C-based languages as if they were 
 pointers, but they have far less obvious meaning in a Swift context where 
 everything is more strongly typed and is safe by design.

I think Swift syntax is actively getting in the way in LLDB. When debugging you 
want to be able to look at data in a more free-form way and get a bit closer to 
the metal. The C expression syntax works pretty well for that, but in Swift 
mode I was stymied.

 It does, when I enable MallocScribble. Could you explain the syntax to set a 
 watchpoint, too? Thanks again…
 
 Per LLDB’s command line help:


We’re going around in circles now. :/ Please look at my original message, 
wherein I was unable to get LLDB to accept any variant of  “watch set 
expression”. It kept giving errors like expression evaluation of address to 
watch failed”. That’s why I posted in the first place.

This might be another instance of Swift syntax not working well. I was stepping 
through assembly code and had the address of an object in a register, and 
wanted to detect when that object was modified. LLDB may have been rejecting my 
commands because the Swift mode wasn’t recognizing a numeric value as an 
address.

—Jens ___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com