No, #bindingOf: is related to compiling a method.
Variables that are accessible thru several methods, like global, class variables or pool variables are shared by storing the same binding in method literals. A binding is a kind of Association whose key is variable name and value is variable value.
When your code use the variable the method send #value to the binding under the hood, and when you store a value into the variable it sends #value:
Note however that - depending on Smalltalk flavour - these operations might be optimized in byte code and replaced with a direct access to 2nd instance variable (the value) of the binding.
So the Compiler needs to retrieve the bindingOf: aSymbol in order to access any shared variable, where aSymbol is the name of the variable. The class into which the method is compiled is queried for that information because the scope of variable access depends on the class (only a class and its subclasses can access the class variables...).
If you want to override instance creation in YourClass, just override #new at class side (we say YourClass class>>#new).
If you use Squeak/Pharo dialect, most of the time, you can achieve specific instantiation by overriding #initialize at instance side (YourClass>>#initialize) especially , since #new will invoke #initialize.
EDIT
If you want to catch the sending of #new to ObjectA with an ObjectTracer, here is what you could do:
| theTrueObjectA |
theTrueObjectA := ObjectA.
[Smalltalk globals at: #ObjectA put: (ObjectTracer on: ObjectA).
"insert the code you want to test here"
ObjectA new]
ensure: [Smalltalk globals at: #ObjectA put: theTrueObjectA].
EDIT2 last sentence can be replaced with ensure: [ObjectA xxxUnTrace]
However, modern squeak debugger is intrusive and will itself send many messages to the ObjectTracer leading to other debuggers popping... You should first open a Preferences window and disable logDebuggerStackToFile.
Note that the mechanism involved is that the message #doesNotUnderstand: is sent by an object when it does not understand a message. The ObjectTracer overrides #doesNotUnderstand: to pop up a debugger.
You can subclass ProtoObject to install your own #doesNotUnderstand: handling (like just writing something in a Transcript or a file).
Also note that ObjectTracer #inheritsFrom: ProtoObject and that ProtoObject itself #respondsTo: many messages that won't be caught by ProtoObject>>#doesNotUnderstand:
Last note: I used # above to indicate messages that can be understood.
EDIT 3: a possible solution is to define a new kind of ObjectTracer with two instance variables tracedObject and messageMapping and this instance creation:
MessageInterceptor class>>on: anObject interceptMessages: aDictionary
"Create an interceptor intercepting some messages sent to anObject.
aDictionary keys define message selectors that should be intercepted.
aDictionary values define block of code that should be evaluated in place.
These blocks always take one argument for passing the traced Object,
plus one argument per message parameter.
snip..."
MessageInterceptor>>doesNotUnderstand: aMessage
mapping := messageMapping at: aMessage selector
ifAbsent:
["We don't intercept this message, let the tracedObject handle it"
^aMessage sendTo: tracedObject].
^mapping valueWithArguments: {tracedObject} , aMessage arguments
For example, you would use it like that:
| interceptor |
interceptor := MessageInterceptor on: ObjectA interceptMessages:
({#new -> [:class | ObjectTracer on: class new]} as: Dictionary).
[Smalltalk globals at: #ObjectA put: interceptor.
"insert the code you want to test here"
ObjectA new yourself]
ensure: [interceptor xxxUnTrace].