0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++ builder XE4, 10.2 Tokyo > case文最後のbreakではブレークできない

Last updated at Posted at 2016-09-22
動作環境
C++ Builder XE4
RAD Studio 10.2 Tokyo Update 2 (追記: 2017/12/28)

Winソフトを実装していて気づいた点。

case文最後のbreakでブレークポイントを設定しても無効になる。

Unit1.cpp
//---------------------------------------------------------------------------

# include <vcl.h>
# pragma hdrstop

# include "Unit1.h"
//---------------------------------------------------------------------------
# pragma package(smart_init)
# pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
static int swithBreakTest(int idx)
{
	switch(idx) {
	case 0:
		OutputDebugString(L"0");
		break;
	case 1:
		OutputDebugString(L"1");
		break;
	case 2:
		OutputDebugString(L"2");
		break;
	}
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
	swithBreakTest(/*idx=*/0);
	swithBreakTest(/*idx=*/1);
	swithBreakTest(/*idx=*/2);
}
//---------------------------------------------------------------------------

以下の画像にて緑色のブレークポイントは無効の意味となる。
実際に実行したところ、緑の部分では停止しなかった。

qiita.png

MSP430などでは_bis_SR_register(LPM3_bits + GIE);の次の行がブレークポイントが取れなかった (コメント )。
コンパイラの最適化が関係していたと教えていただいたことがあるが、XE4でも同じようなことが起きているのだろうか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?