How can I `grep`/`awk`/`sed` a file looking for some pattern, and print the entire line (including continuation lines if the matched line ends with `\`?

File `foo.txt` contains:

```
something
whatever
thisXXX line \
    has a continuation line
blahblah
a \
multipleXXX \
continuation \
line

```

What should I execute to get (not necessarily in one line, not necessarily removing multiple spaces):

```
thisXXX line has a continuation line
a multipleXXX continuation line

```

BTW I'm using bash and fedora21, so it does not need to be POSIX-compliant (but I'll appreciate a solution if it is POSIX)