The structure V + 을 걸 그랬다 is typically used for self-reflection and expresses regret for not taking an action (‘I regret not doing sth I should have done’). 그랬다 can be omitted with no change in meaning:
이렇게 날씨가 나쁠 줄 알았으면 우산을 가져올 걸 그랬어요.
If I’d known the weather was this bad, I would have brought my umbrella (but I didn’t).
더 일찍 한국어를 배울 걸.
I should have learned Korean earlier (but I didn’t).
네가 오는 줄 알았으면 음식을 만들 걸.
If I’d known you were coming I would have prepared something to eat (but I didn’t know, so I didn’t prepare).
Adding 지 마 (derived from 지 않다) before the main verb changes the meaning to ‘I regret doing sth I shouldn’t have done’:
질문을 하지 말 걸 그랬어요.
I shouldn’t have asked (but I did).
지난 밤에 늦게까지 깨어있지 말 걸 그랬어요.
I shouldn’t have stayed up late last night (but I did).
맥주를 마시지 말 걸 그랬어요.
I shouldn’t have drunk so much beer (but I did).
The question form replaces 그랬다 with 그랬나?:
여기에 더 일찍 올 걸 그랬나?
Should I have come here earlier? (Am I late?)
양복을 입을 걸 그랬나?
Should I have worn a suit? (Am I underdressed?)
그에게 말할 걸 그랬나?
Should I have spoken to him?