Green’s Dictionary of Slang

flag of distress n.

1. an advertisement or similar statement of charges for board and lodging.

[UK]Hotten Dict. of Modern Sl. etc. (2nd edn).
[UK]Hotten Sl. Dict.
[UK]Partridge DSUE (1984) 399: [...] from ca. 1855.

2. thus a generic term for poverty.

[[UK]Grose Classical Dict. of the Vulgar Tongue ms. additions n.p.: Flag of Distress the Cockade of a half pay Officer].
[UK]Hotten Dict. of Modern Sl. etc. (2nd edn).
[UK]Sl. Dict. 163: Flag of distress any overt sign of poverty; the end of a person’s shirt when it protrudes through his trousers.
[UK]Partridge DSUE (1984) 399: [...] from ca. 1855.

3. the end of a person’s shirt protruding through a hole in their trousers.

[UK]Hotten Dict. of Modern Sl. etc. (2nd edn).
[UK]Hotten Sl. Dict.
[Aus]Crowe Aus. Sl. Dict. 29: Flag of Distress, the fall of one’s shirt through the seat of his trousers.
[UK]Partridge DSUE (1984) 399: [...] from ca. 1855.

In phrases

hang out the flag of distress (v.)

1. to advertise charges for board and lodging.

[UK]Reynolds’s Newspaper 21 Jan. 4/5: Ttiled persons [...] now deem it not derogatory ‘to hang out a flag of distress [...] to make known that they have an attic unoccupied’.

2. to live in furnished accommodation.

[Scot]Dundee Advertiser 18 Nov. 2/2: Napoleon [...] has been obliged to hang out the flag of distress, and admit that he is [...] ‘hard up’.
[UK]J. Manchon Le Slang.

3. to be a street prostitute.

[UK]J. Manchon Le Slang.