MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / LineCallback

Method LineCallback

src/server/angelscript/add_on/debugger/debugger.cpp:165–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void CDebugger::LineCallback(asIScriptContext *ctx)
166{
167 assert( ctx );
168
169 // This should never happen, but it doesn't hurt to validate it
170 if( ctx == 0 )
171 return;
172
173 // By default we ignore callbacks when the context is not active.
174 // An application might override this to for example disconnect the
175 // debugger as the execution finished.
176 if( ctx->GetState() != asEXECUTION_ACTIVE )
177 return;
178
179 if( m_action == CONTINUE )
180 {
181 if( !CheckBreakPoint(ctx) )
182 return;
183 }
184 else if( m_action == STEP_OVER )
185 {
186 if( ctx->GetCallstackSize() > m_lastCommandAtStackLevel )
187 {
188 if( !CheckBreakPoint(ctx) )
189 return;
190 }
191 }
192 else if( m_action == STEP_OUT )
193 {
194 if( ctx->GetCallstackSize() >= m_lastCommandAtStackLevel )
195 {
196 if( !CheckBreakPoint(ctx) )
197 return;
198 }
199 }
200 else if( m_action == STEP_INTO )
201 {
202 CheckBreakPoint(ctx);
203
204 // Always break, but we call the check break point anyway
205 // to tell user when break point has been reached
206 }
207
208 stringstream s;
209 const char *file = 0;
210 int lineNbr = ctx->GetLineNumber(0, 0, &file);
211 s << (file ? file : "{unnamed}") << ":" << lineNbr << "; " << ctx->GetFunction()->GetDeclaration() << endl;
212 Output(s.str());
213
214 TakeCommands(ctx);
215}
216
217bool CDebugger::CheckBreakPoint(asIScriptContext *ctx)
218{

Callers

nothing calls this directly

Calls 5

GetStateMethod · 0.80
GetCallstackSizeMethod · 0.80
GetDeclarationMethod · 0.80
GetLineNumberMethod · 0.45
GetFunctionMethod · 0.45

Tested by

no test coverage detected